Call me paranoid but I always like to keep backup copies of files I work on either when fixing a small defect or when developing a large feature.
Quickly being able to take a backup of files or restoring them to a destination folder is what I really want to do. Copying files around is not really an issue but when dealing with source code, the folder structures are usually pretty complicated. So what I need is a way to copy files around and create the destination folder structure at the same time.
Recently I wrote a small utility called scp for Super-copy which does exactly this. Straight off let me tell you that it is not a replacement for xcopy or other utilities. To understand what scp does, just read along.
SCP c:\projects\helloworld\headers\hello.h d:\mybackups\helloWorld\v1\headers
The above command will copy hello.h to d:\mybackups\helloWorld\v1\headers even if the entire destination path does not exist.
Usually when working on a feature or a bug, I have a list of modified files. So what I do now is have this list in a batch file like this:
SET SRC=c:\source\myproject
SET DST=e:\backups\April-10
copy %SRC%\headers\header1.h %DST%\headers
copy %SRC%\code\impl.cpp %DST%\impl
By doing this, I just need to set DST to any folder I want and run the script. The script will copy all the specified files and also maintain the folder structure specified in the destination path.
This utility works well when you know the exact files you want to preserve. It supports wild cards as well. If you find SCP useful, I would love to hear about it.