Is there a way to change the date when a file was modified/created (which is shown in Nautilus or with the ls -l command)? Ideally I am looking for a command which can change the date/time stamps of a whole bunch of files to a certain amount of time earlier or later (e.g. +8 hours or -4 days etc.).
|
You can change the modification time of a file using the
By default this will set the file's modification time to the current time, but there are a number of flags, such as the
If you want to modify the file relative to its existing modification time instead, the following should do the trick:
If you want to modify a large number of files, you could use the following:
You can change the arguments to
This form isn't possible with the file time relative version because it uses the shell to form the arguments to As far as the creation time goes, most Linux file systems do not keep track of this value. There is a |
|||||||||||||||||||||
|
|
Thanks for the help. This worked for me: In the terminal go to the directory for date-edit. Then type:
You wil see a ">" after you hit enter, exept for the last time -> "done". Note: You may want to change "201203101513" "201203101513" = is the date you want for all the files in this directory. |
||||
|
|
|
This little script at least works for me
|
|||
|
|
|
It's been a long time since I wrote any kind of Unix program, but I accidentally set the year incorrectly on a bunch of Christmas photos, and I knew if I didn't change the date from 2015 to 2014 it would be a problem later on. Maybe, this is an easy task, but I didn't find any simple way to do it. I modified a script I found here, which originally was used to modify the date by minus one month. Here's the original script:
Here's my modified script that forced the date to the year "2014":
I now realize I could have done a more generic version:
To use this file you would need to write it and
to execute:
fn=your-file-name-that-is-your-command Example
will change the date by minus one year in the directory where you are. |
||||
|
|
|
Easiest way - accessed modified will be the same:
Where:
If you wish to use To verify they are all the same:
See: touch man |
|||
|
|
|
just change date and time in settings. then save your file, it automatically changes |
|||||||||||||
|