Saturday, July 2, 2011

for oneliner - make backups in a directory

Create a backup copy of all filenames of a specific extension:
for f in *.c; do cp $f $f.c.backup; done
This will find all "c" files in the current directory you are in and then make a copy of them, appending ".backup" to the end of the original filename.

Simple, and maybe overused....yet so nice to use sometimes when pushing around a lot of files.