1

I am learning C# AND Java and I often create small projects and programs in these languages. Usually my source code is at C:......\Visual Studio 2010\Projects\MyProject or C:......\Eclipse\Projects\MyProject.

I often get to a point where the code is partially working and while trying to add a new feature I end up breaking the working code. It is frustrating to fix all the changes and get back to the old state and takes a long time just to go back to where I came from.

I was wondering if you could help me write a batch (or Win PowerShell?) script to back up my source folders to a D:\Backup\SourceCode\CSharp\MyProject and D:\Backup\SourceCode\Java\MyProject. And place the script on my desktop so that i can run it time to time whne i have good working code.

Or if there are any other solutions to this problem that you might be using are also welcome.

2 Answers 2

3

I would use Mercurial source control there is a nice tutorial at Hg Init.

Git is another option, but Mercurial is easier to use IMO.

You can get free, private source hosting for Mercurial at bitbucket.

Sign up to request clarification or add additional context in comments.

Comments

2

A real version control system is far better. I would recommend GIT

Here is a batch example to do what you want:

REM Delete backup directory
if exist D:\Backup\Code\*.* rd D:\Backup\Code /s /q

REM Create/recreate backup directory
mkdir D:\Backup\Code

REM Copy files/folders
xcopy "C:\SourceCodeFolder" /e /i /y D:\Backup\Code

cls
exit

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.