Discussion Locked

command

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I want to copy a file from the unix command line to a new name that has the date (and possibly time) as part of the name. For example:
cp abc.txt abc20030108.txt.

Could someone please tell me how to get the current date/time concatenated to the name of the file?

Thanks

3 replies

by alveden

Follow the example below

cp abc.txt abc`date +%Y%m%d`.txt

Take note of the quotation used, is essential.

This discussion is closed to new replies.