modifying the timestamps of multiple files
I have been trying to change the date created and date modified for multiple files inside multiple sub folders. There are about 29000 files spread access 500 folders, each with at least 1 level of sub-folders within.
I have been experimenting with the touch command via terminal, but can't get it to work for more than 1 sub solder (about 15 files) at a time.
I am working on the files locally on an external hard drive.
What syntax do I need to use in order to bulk process all of these files in one go, changing both the date created and date modified to a specific timestamp (20200601 12:01:01 for example).
cheers
The typical way to do this on Unix-based system is to combine find
and touch
find path/to/top/directory -type f -exec touch -t 0601120101 '{}' +
-
path/to/top/directory
: top directory to start search in, its content and all subdirectories will be searched. You can add several if required -
type -f
: only find files. If you also want totouch
directories, just remove it -
exec ... +
: run the command on the matching items (in our case all files), replacing{}
with the names of the items.
PS: To just see the files found use find path/to/top/directory
.