I'm new to terminal and unix like systems. I'm searching a way to automatically create a batch file.
Let's say I have a bunch of files in a folder, and I want to change the creation dates. As it is now, I have to touch -t 201704011215.00 Desktop/Old_cam_vids_converted_from_avi_to_mp4/file0001.mp34
for each file. What I would like to do is something like this: ls -lT /Desktop/Old_avi_to_conv/*.avi
and have the date and time for each file as time-date parameter for the touch command.
How can I accomplish this?
Edit: I hope the explanation makes it clearer. This is the scenario:
- Two folders on the desktop containing video files.
- one (folder_1) contains the original files (.avi)
the second (folder_2) contains converted files (.mp4)
all the files in the second folder have a newer sequential date, since the conversion tool made worked through a list of files.
I need to take the date/time stamp from the original file, in the first folder and assign it to the converted file in the second folder.
each file in the first folder has a different date, possibly days and months apart.
the files in the second folder have the same names than the ones in the first folder, except for the file suffix, e.g.: folder_1/CIMG_0001.avi is the original of folder_2/CIMG_0001.mp4 folder_1/PIC_0003.avi is the original of folder_2/PIC_0003.mp4 folder_1/PIC_0015.avi is the original of folder_2/PIC_0015.mp4 folder_1/CIMG_003.avi id the original of folder_2/CIMG_0003.mp4
-r
option with touch, such astouch -r /path/to/file.avi /path/to/file.mp4
. This still will not change the creation/birth time., for that you would useSetFile
.