Click to See Complete Forum and Search --> : Is there a date stamp way to name a file ?


Donovan
12-01-2000, 08:30 AM
Hi, is there a way to include a time or date stamp when I move a file ?

For example:
mv filename filename+date

?

Donov

njcajun
12-01-2000, 12:04 PM
Well, I guess you could probably do 'man date' and it'll probably give you a way to do it in there, but just so you know, the date last modified is listed with the file when you do 'ls -l'.


------------------
...meanwhile, I remain...
...The RedHatted Stepchild...

Donovan
12-01-2000, 12:17 PM
Yes, I know, but I would like to be able to generate files with different names each times, and a data stamp seems a good way to do it. I'll man date anyway.

Thanks,
Donov

ascend
12-01-2000, 12:24 PM
not sure i really follow the question...

you can time stamp a file using
ascend# touch -t mmddyyyy filename

which will make the "last modified time" equal to the date specified.


if you want to rename the file to a file named by the dat, you could write a little script.
it would have to saying something like:

...
FILE=$1
NEW_FILE=$(date +%m%d%y)
mv $FILE $NEW_FILE
...


Today, that would move the file to 12012000. Does that help at all?


[This message has been edited by ascend (edited 01 December 2000).]