Appending the file modified date to the file name

mike nobody at nospam.hostisimo.com
Tue Dec 1 00:07:50 UTC 2015


On 11/30/2015 03:50 PM, Robert Moskowitz wrote:
> I am pulling a bunch of recordings off my android phone.  I found
> simple-mtpfs to be able to use 'cp -a' to actually copy the files and
> preserve their date information.
>
> Now I want to rename these files, which are all lectures to have the
> date of creation/lastmodified in the file name.  All my searching has
> only found how to put the current date into the file name, I can'f find
> anything on using the actual file date.
>
> Can anyone point me to how to do this?

You can get the date/time in any format you like using ls.

ls -lt --time-style=format string

where format string consists of the same rules used by the "date" command.



More information about the users mailing list