I am looking to write a Linux shell script in order to perform a backup and restore of all of the source code in my project folder (.c, .cpp, .java, etc)
My script deletes all of these source code files and I want to be able to easily restore the files as well if need be.
Here is what I am doing now:
#copy the entire directory to a backup folder
cp -r $CLEANUP_PATH $BACKUP_PATH
#delete the project and copy from backup to restore source code
rm -rf $CLEANUP_PATH
cp -r $BACKUP_PATH $CLEANUP_PATH
The project is around 600MB, so it takes a long time when I perform these actions.
How would I be able to restore only the source code (rather than the entire directory) from a backup and ensure that each file is restored to the specific directories that each file belongs in?
cp -rcopy dot files? i.e. .exrc, etc?