//View Tip #172
Similar Tips
» Mass-renaming files
» Random xkcd comic
» Check low space
» Using sed across multiple lines
» Directory Tree

 

Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
To create a set of backed up files with the current date added at the end of the file name try the following:

ls *txt | sed "s/.*/cp & &.$(date "+%Y%d%m")/"


This will run the following commands:

cp 1.txt 1.txt.20082703

cp 2.txt 2.txt.20082703
cp 3.txt 3.txt.20082703


View Comments »




Comments 

Add your comment

Comments are currently disabled
No Comments

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit