somewhat daily mutterings

/Programming/Projects/Gemcast Organizing by File Dates Sucks

So, this morning I decided to move some of my files around to better fit my category taxonomy. I had written some stuff about the iPod, and decided to move those items from my main category down to the Music category. Simple, I thought, I'll just do the following:

cp `grep iPod *.txt` Music

I did a 'cp', rather than a move, in order to double-check that the results of the command worked. After that, I 'rm'd the files from the original location. Cool, no problem, I thought. I thought wrong. The files I copied now all had today's date, therefore, they sorted incorrectly into my weblog. Dufus!

Fortunately this could be fixed with a bit of Ruby magic:

ruby -e 'File.utime(Time.local(2003, "Feb", 16, 0, 0, 0), \
         Time.local(2003, "Feb", 16, 0, 0, 0), \
         "filename.txt")'

Luckily, I'd written the entries fairly recently, so I could make a reasonable guess as to when they were composed.

Posted: Tue Feb 25 07:39:49 -0800 2003

Thanks for visiting! Send comments to Mike Thomas.

Site 
Meter