Changing file timestamps

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
User avatar
GS3
Level 4
Level 4
Posts: 299
Joined: Fri Jan 06, 2017 7:51 am

Changing file timestamps

Post by GS3 » Sat May 26, 2018 7:39 am

In Windows I have a little GUI program which allows me to change timestamps of files. I can right-click on a file name and in the context menu I get the option for "Properties Plus" which allows me to set the three dates (created, modified and accessed) as well as all other attributes at will. I find this very useful. Is there anything similar in Linux?
HP Compaq Elite 8300 CMT - Linux Mint 18.2 Sonya - Kernel 4.4.0-116-generic X64 - Cinnamon 3.4.4 - Nemo

User avatar
Sir Charles
Level 7
Level 7
Posts: 1833
Joined: Thu Jan 04, 2018 1:00 pm

Re: Changing file timestamps

Post by Sir Charles » Sat May 26, 2018 8:32 am

I suppose that's one of the ironies of life, doing the wrong thing at the right moment -C.C.

User avatar
WharfRat
Level 20
Level 20
Posts: 11428
Joined: Thu Apr 07, 2011 8:15 pm

Re: Changing file timestamps

Post by WharfRat » Sat May 26, 2018 8:33 am

The only thing I can think of is touch with the -c or --no-create option.

See man touch and info '(coreutils) touch invocation'
ImageImage

User avatar
GS3
Level 4
Level 4
Posts: 299
Joined: Fri Jan 06, 2017 7:51 am

Re: Changing file timestamps

Post by GS3 » Sat May 26, 2018 9:10 am

Thanks both. I guess "touch" can come in handy for something important enough but it is just too complicated for everyday things I do. I realize hard core Linux users master the command line but I am not there yet and each time I need to do something like that I would need to dig out my notes and it would take me longer than it is worth. I am used to the convenience of GUI.
HP Compaq Elite 8300 CMT - Linux Mint 18.2 Sonya - Kernel 4.4.0-116-generic X64 - Cinnamon 3.4.4 - Nemo

User avatar
trytip
Level 7
Level 7
Posts: 1849
Joined: Tue Jul 05, 2016 1:20 pm

Re: Changing file timestamps

Post by trytip » Sat May 26, 2018 10:51 am

you'll need a commander like https://sourceforge.net/projects/doublecmd/ extract and run executable doublecmd>show hidden files>file>change attributes
Image

Mute Ant
Level 13
Level 13
Posts: 4901
Joined: Tue Sep 03, 2013 7:45 pm

Re: Changing file timestamps

Post by Mute Ant » Sat May 26, 2018 4:53 pm

There appear to be four timestamps...
https://blog.fpmurphy.com/2014/06/file- ... -ext4.html
https://en.wikipedia.org/wiki/Ext4
...with the newest 'birth' stamp left in limbo until someone decides what it should actually mean. It's not impossible that there is a birth-time set for a file that none of the other GNU tools can show. If you need to be certain the file's old life is forgotten, I suggest you make a genuinely new file...
cat old > new && mv new old

The stat command has useful defaults... stat /bin/true ----->
  • File: /bin/true
    Size: 30516
    Blocks: 60
    IO Block: 1024 regular file
    Device: 700h/1792d
    Inode: 148
    Links: 1
    Access: (0755/-rwxr-xr-x)
    Uid: ( 0/ root)
    Gid: ( 0/ root)
    Access: 2017-02-22 12:23:45.000000000 +0000
    Modify: 2017-02-22 12:23:45.000000000 +0000
    Change: 2017-02-22 12:23:45.000000000 +0000
    Birth: -
Data stored in an encrypted volume will only be accessible with the original password. Without this key, all the data will remain scrambled beyond hope of recovery.

User avatar
GS3
Level 4
Level 4
Posts: 299
Joined: Fri Jan 06, 2017 7:51 am

Re: Changing file timestamps

Post by GS3 » Sat May 26, 2018 7:21 pm

Very often the reason I want to change a timestamp is that I process a photo and want the resulting file to have a timestamp near the original photo and not later when I did the processing. Also I might make a minor modification in a document but want it to keep the original timestamp.

In windows I just right-click and select the new timestamp I want to set. Anything more complicated is not worth the trouble.
HP Compaq Elite 8300 CMT - Linux Mint 18.2 Sonya - Kernel 4.4.0-116-generic X64 - Cinnamon 3.4.4 - Nemo

User avatar
slipstick
Level 5
Level 5
Posts: 739
Joined: Sun Oct 21, 2012 9:56 pm
Location: Somewhere on the /LL0 scale

Re: Changing file timestamps

Post by slipstick » Sat May 26, 2018 8:39 pm

As trytip said earlier, you can use doublecmd. Highlight the file, click on Files in the Menu bar (or Alt-F), then click on Change Attributes (or press the "a" key) and you get a window that lets you change the timestamp and other attributes.

Code: Select all

sudo apt-get install doublecmd-gtk
Last edited by slipstick on Sat May 26, 2018 10:47 pm, edited 1 time in total.
In theory, theory and practice are the same. In practice, they ain't.

User avatar
Flemur
Level 15
Level 15
Posts: 5929
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Changing file timestamps

Post by Flemur » Sat May 26, 2018 10:16 pm

GS3 wrote:
Sat May 26, 2018 7:21 pm
Very often the reason I want to change a timestamp is that I process a photo and want the resulting file to have a timestamp near the original photo and not later when I did the processing.
https://unix.stackexchange.com/question ... f-metadata
The EXIF handling tool exiv2 has a builtin option for this:
exiv2 -T rename image.jpg
sets the time of last file modification, mtime, to the date stored in the EXIF metadata.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Mint 18.3 Xfce/fluxbox/pulse-less
Xubuntu 17.10/fluxbox/pulse-less

User avatar
GS3
Level 4
Level 4
Posts: 299
Joined: Fri Jan 06, 2017 7:51 am

Re: Changing file timestamps

Post by GS3 » Sun May 27, 2018 1:50 am

The EXIF handling tool exiv2 has a builtin option for this:
exiv2 -T rename image.jpg
sets the time of last file modification, mtime, to the date stored in the EXIF metadata.
Yeah, that's not what I am trying to do.
HP Compaq Elite 8300 CMT - Linux Mint 18.2 Sonya - Kernel 4.4.0-116-generic X64 - Cinnamon 3.4.4 - Nemo

User avatar
GS3
Level 4
Level 4
Posts: 299
Joined: Fri Jan 06, 2017 7:51 am

Re: Changing file timestamps

Post by GS3 » Sun May 27, 2018 7:46 am

I installed doublecmd-gtk and it allows me to change the timestamps although it is awkward because I need to start the program, navigate to the file and select it and then in the menu bar go to files - change attributes. It is quite cumbersome compared to what I do in Windows but I guess it will have to do. Thanks for pointing me to it.
HP Compaq Elite 8300 CMT - Linux Mint 18.2 Sonya - Kernel 4.4.0-116-generic X64 - Cinnamon 3.4.4 - Nemo

User avatar
phd21
Level 16
Level 16
Posts: 6549
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: Changing file timestamps

Post by phd21 » Sun May 27, 2018 1:40 pm

Hi GS3,
GS3 wrote:I installed doublecmd-gtk and it allows me to change the timestamps although it is awkward because I need to start the program, navigate to the file and select it and then in the menu bar go to files - change attributes. It is quite cumbersome compared to what I do in Windows but I guess it will have to do. Thanks for pointing me to it.
Out of curiosity, just exactly step by step did you change those files timestamps in MS Windows that was less "cumbersome" than using a file manager in Linux that has the ability to change file timestamps? Did you not have to bring up MS Windows file manager (explorer), navigate to the file(s) and select it, and then select some option to change the file timestamps?

Once you have selected the file(s) to change their timestamps, there might be a keyboard shortcut or right-click option to go directly to changing the file attributes like timestamps, or you can add one. There may also be file manager add-ons and or "scripts" to perform this function and other functions. Most file managers can also have their right-click menu modified to add functions.

As for photos and images, there are numerous image browsers, image editors, and other applications, that can easily change the file timestamps based on various criteria.

There are renaming applications like the superb "Krename" that can also change file timestamps and or add them to the filename so that the original timestamp is available regardless of other file activities.

You can also change Linux Mint to not update file access times by adding "noatime" to the "fstab" file which is highly recommended for anyone using SSDrives.

Hope this helps ...
.
KDE_Dolphin_FileManager_Timestamp1.jpg
My KDE Dolphin File Manager TimeStamp
.
KDE_Dolphin_FileManager_Timestamp2.jpg
My KDE Dolphin File Manager TimeStamp
Last edited by phd21 on Sun May 27, 2018 1:49 pm, edited 1 time in total.
Phd21: Mint KDE 17.3 & 18.3, 64-bit Awesome OS, Ancient Dell OptiPlex 780 Core2Duo E8400 3GHz,4gb Ram,256gb SDD, Video: Intel 4 Graphics, DVD Lightscribe. Why I use KDE?:https://opensource.com/life/15/4/9-reasons-to-use-kde

User avatar
GS3
Level 4
Level 4
Posts: 299
Joined: Fri Jan 06, 2017 7:51 am

Re: Changing file timestamps

Post by GS3 » Sun May 27, 2018 1:46 pm

phd21 wrote:
Sun May 27, 2018 1:40 pm
Out of curiosity, just exactly step by step did you change those files timestamps in MS Windows that was less "cumbersome" than using a file manager in Linux that has the ability to change file timestamps? Did you not have to bring up MS Windows file manager (explorer), navigate to the file(s) and select it, and then select some option to change the file timestamps?
Nope. Right click on file, select properties and the dialogue window pops up which allows changing attributes, timestamps, etc.
HP Compaq Elite 8300 CMT - Linux Mint 18.2 Sonya - Kernel 4.4.0-116-generic X64 - Cinnamon 3.4.4 - Nemo

User avatar
phd21
Level 16
Level 16
Posts: 6549
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: Changing file timestamps

Post by phd21 » Sun May 27, 2018 2:18 pm

Hi GS3,

That is not an accurate reply.

How did you right click the file and from where? Obviously, you first had to bring up up some form of file browser (file manager), clicked My Computer, etc... to locate the file(s) before you could right-click it right?

You can do a lot in Linux Mint and the various applications, you just do not know how to do it yet.

Let's use the Double Commander file manager as an example. You can already click "File" ->" Change attributes". There are two easy to implement options for changing or viewing file attributes like timestamps.

1.) Add a new toolbar button for going directly to Change Attributes including Timestamps. 3 steps: Bring up Double commander, click file(s), click toolbar button.

2.) Add a new Keyboard shortcut for going directly to Change Attributes including Timestamps. 3 steps: Bring up Double commander, click file(s), click hotkey.

Hope this helps ...
.
DoubleCommander2.jpg
Double Commander - change or view attributes
.
DoubleCommander3.jpg
Double Commander - add toolbar button
.
DoubleCommander1.jpg
Double Commander - add shortcut
Phd21: Mint KDE 17.3 & 18.3, 64-bit Awesome OS, Ancient Dell OptiPlex 780 Core2Duo E8400 3GHz,4gb Ram,256gb SDD, Video: Intel 4 Graphics, DVD Lightscribe. Why I use KDE?:https://opensource.com/life/15/4/9-reasons-to-use-kde

User avatar
GS3
Level 4
Level 4
Posts: 299
Joined: Fri Jan 06, 2017 7:51 am

Re: Changing file timestamps

Post by GS3 » Sun May 27, 2018 2:35 pm

What I can do in Windows and would like to be able to do in Linux but have not been able so far to do in Linux is clearly stated in the OP.
HP Compaq Elite 8300 CMT - Linux Mint 18.2 Sonya - Kernel 4.4.0-116-generic X64 - Cinnamon 3.4.4 - Nemo

User avatar
trytip
Level 7
Level 7
Posts: 1849
Joined: Tue Jul 05, 2016 1:20 pm

Re: Changing file timestamps

Post by trytip » Sun May 27, 2018 8:53 pm

even in windows you had to install it right? i remember i installed a lot of small programs that added extensions in file properties one of them was jpeg info or video stats or md5 checksums.
you're tight that it should be easier to do this in linux, and it's a shame touch is the only thing linux offers. if you had to change 1000 files with commandline and touch it would take quite long. i don't mind command line when it's one or two words but in complex commands that include punctuation an other characters it is easy to get lost

i never really used doublecommander, but i did use total commander in windows very often had it integrated into my context menu to easily open and that's where i found the change attributes ability

linux is advance enough to add this to properties but i'm no expert. in the likes of total commander alternates for linux are tuxcommander,gnome-commander,double commander but not all of them have same options
Image

Post Reply

Return to “Newbie Questions”