How to give all files the same modification time
These are instructions for a friend of mine who’s not super-techy. He’s on a Mac, & periodically he needs to make sure all the files in a directory have the same date & time. The command line to the rescue1!
-
Open Terminal by using Alfred or Spotlight (search for Terminal & when it’s found, make sure it’s selected & press Enter).
-
In Terminal, type
cd
followed by a space, but do not press Enter. -
In Finder, find the folder that contains the files you want to change. Select that folder & drag it into Terminal. When you let go, you should now see the path to your folder after the
cd
, so that it looks like this:cd /Users/scott/Movies/My\ Project
. -
Press Enter in Terminal.
-
If you want to change the modification time of all the files, enter the following in Terminal:
touch *
(that’s an asterisk). Press Enter. Note that this will change every file in the folder. If you only want to change the mp4 files, you’d typetouch *.mp4
; to change the mov files, you’d typetouch *mov
, and so on. -
To verify that all files now have the same date, type
ls -l
in Terminal & press Enter. You’ll see a bunch of info, but you should be able to tell that the dates of all the files are now the same. -
Close Terminal.
-
Of course, he could also buy my book Linux Phrasebook & read the section on
touch
. Just sayin’. ↩