« Awesome Bookmarks Sync with Google Browser Sync | Main | Unix Bash shell: matching files with one or more digits, but NOT other characters »

January 31, 2008



Yes, but use capital Y to get a 4 digit year.

mystring=`date "+%Y%m%d-%H%M%S"`

Y2K was only a few years ago. My files with automatic filenames from the 80's still sort in 'ls' properly with new files.

date "+%Y_%m_%d-%H:%M:%S"
is more human readable, and still does proper date/time sorting with 'ls'.

I have over a million files in my home directory (tree) on my home system. Some date to the 1970s. So, yes, they predate my use of Linux. My point is that you've no idea how long files will last. And you can even want old files retroactively (crossing the century boundary).

The comments to this entry are closed.