Changing file timestamps

Quick to answer questions about finding your way around Linux Mint as a new user.
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. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
GS3
Level 8
Level 8
Posts: 2384
Joined: Fri Jan 06, 2017 7:51 am

Changing file timestamps

Post by GS3 »

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?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Please do not use animated GIFs in avatars because many of us find them distracting and obnoxious. Thank you.
Sir Charles

Re: Changing file timestamps

Post by Sir Charles »

WharfRat

Re: Changing file timestamps

Post by WharfRat »

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

See man touch and info '(coreutils) touch invocation'
User avatar
GS3
Level 8
Level 8
Posts: 2384
Joined: Fri Jan 06, 2017 7:51 am

Re: Changing file timestamps

Post by GS3 »

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.
Please do not use animated GIFs in avatars because many of us find them distracting and obnoxious. Thank you.
User avatar
trytip
Level 14
Level 14
Posts: 5366
Joined: Tue Jul 05, 2016 1:20 pm

Re: Changing file timestamps

Post by trytip »

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

Re: Changing file timestamps

Post by Mute Ant »

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: -
User avatar
GS3
Level 8
Level 8
Posts: 2384
Joined: Fri Jan 06, 2017 7:51 am

Re: Changing file timestamps

Post by GS3 »

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.
Please do not use animated GIFs in avatars because many of us find them distracting and obnoxious. Thank you.
User avatar
slipstick
Level 6
Level 6
Posts: 1071
Joined: Sun Oct 21, 2012 9:56 pm
Location: Somewhere on the /LL0 scale

Re: Changing file timestamps

Post by slipstick »

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 20
Level 20
Posts: 10096
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Changing file timestamps

Post by Flemur »

GS3 wrote: Sat May 26, 2018 7:21 pmVery 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?
User avatar
GS3
Level 8
Level 8
Posts: 2384
Joined: Fri Jan 06, 2017 7:51 am

Re: Changing file timestamps

Post by GS3 »

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.
Please do not use animated GIFs in avatars because many of us find them distracting and obnoxious. Thank you.
User avatar
GS3
Level 8
Level 8
Posts: 2384
Joined: Fri Jan 06, 2017 7:51 am

Re: Changing file timestamps

Post by GS3 »

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.
Please do not use animated GIFs in avatars because many of us find them distracting and obnoxious. Thank you.
phd21
Level 20
Level 20
Posts: 10104
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: Changing file timestamps

Post by phd21 »

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
.
KDE_Dolphin_FileManager_Timestamp2.jpg
Last edited by phd21 on Sun May 27, 2018 1:49 pm, edited 1 time in total.
Phd21: Mint 20 Cinnamon & KDE Neon 64-bit Awesome OS's, Dell Inspiron I5 7000 (7573, quad core i5-8250U ) 2 in 1 touch screen
User avatar
GS3
Level 8
Level 8
Posts: 2384
Joined: Fri Jan 06, 2017 7:51 am

Re: Changing file timestamps

Post by GS3 »

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.
Please do not use animated GIFs in avatars because many of us find them distracting and obnoxious. Thank you.
phd21
Level 20
Level 20
Posts: 10104
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: Changing file timestamps

Post by phd21 »

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
.
DoubleCommander3.jpg
.
DoubleCommander1.jpg
Phd21: Mint 20 Cinnamon & KDE Neon 64-bit Awesome OS's, Dell Inspiron I5 7000 (7573, quad core i5-8250U ) 2 in 1 touch screen
User avatar
GS3
Level 8
Level 8
Posts: 2384
Joined: Fri Jan 06, 2017 7:51 am

Re: Changing file timestamps

Post by GS3 »

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.
Please do not use animated GIFs in avatars because many of us find them distracting and obnoxious. Thank you.
User avatar
trytip
Level 14
Level 14
Posts: 5366
Joined: Tue Jul 05, 2016 1:20 pm

Re: Changing file timestamps

Post by trytip »

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
Locked

Return to “Beginner Questions”