On Tue, 2006-01-24 at 15:02 +0100, Istvan Gabor wrote:
How could I rename the files in a batch so that the file names themselves would contain the date? Eg. file-name.txt --> file-name_date.txt I have many files I'd like to rename.
Something on the lines of "mv file-name.txt file-name`date`. txt.
When you enclose a command in a pair of ` (that's the key to the left of the number 1) the results of the command are used. You'd use the date format you need. For example date +%jreturns the day of the year.
I think it's not that simple. You have to retrieve the file's ctime or mtime and use that value in the filename. Using `date` command doesn't retrieve the file's mtime or ctime. Maybe some awk or sed command could be used.
Not saying it is the case here, but I can only think of one reason someone does not want the timestamp changed on a modified file is that they are trying to hide something. As I said it may not be the case, but. -- Ken Schneider UNIX since 1989, linux since 1994, SuSE since 1998