13
submitted 3 weeks ago* (last edited 3 weeks ago) by [email protected] to c/[email protected]

There is a very annoying problem with archive extraction on Linux. I always sort my files by "last modified" and want my latest files and folders on top in any file manager. When I download and extract an archive, the extracted folder is placed toward the middle or bottom of the list apparently because the original timestamps of files are retained. If I'm not mistaken I didn't have this issue on my MacBook and the extracted archives would appear on the top of the list.

Workaround: In Ark if I choose extract to subfolder and type a name for the new folder, it is treated as recently modified and is placed at the top. But I don't want to enter a name every time.

Shouldn't an extracted folder be treated as recently modified??

Any ideas?

all 8 comments
sorted by: hot top controversial new old
[-] [email protected] 3 points 3 weeks ago

When you extract file and create a new folder/directory, then off course it is treated as recently modified, because you just created it. This is much different than just extracting a directory from archive as it is to preserve its original attributes.

I just tested and observed following:

  • Open archive file by double clicking in the default application Ark (with GUI). Extract a sub directory from the archive by dragging it out into my filemanager Dolphin. The original last modified date is preserved.
  • On the contrary, I right mouse click the archive in my filemanager Dolphin and use the Extract > Extract here menu entry. This will extract the files and the sub directories have new last modified dates, but not the files. This does not need any manual folder creation by you.

I assume you want to solve this by only using the GUI. Because using commandline in the terminal these stuff could be solved. With a script this can be even automated. On the other hand, maybe you (or someone else) could create a script with the exact behavior you wish and then you can just right mouse click on the archive, and choose "open with ... the_special_script", which also updates the folder with newest last modified date in example.

[-] [email protected] 2 points 3 weeks ago

On the contrary, I right mouse click the archive in my filemanager Dolphin and use the Extract > Extract here menu entry. This will extract the files and the sub directories have new last modified dates, but not the files. This does not need any manual folder creation by you.

Are you sure? I just tried this and the extracted folder is not on top.

[-] [email protected] 2 points 3 weeks ago

I removed my other reply, as it is a bit complicated and not straight forward. I thought a little bit about this how to communicate all of this with you, so it is easy to understand. Problem is, this is not easy. Without confusing you again, I want to say it even depends on the file format. In the one tested .7z file the date was preserved for a subfolder inside a folder from the archive. It was not the same for a .tar.gz. Maybe it depends on how the dates were saved in the archive too.

And then it's really confusing thing in the graphical interface of Ark is, when you double click the file and it opens the window. When you extract a subfolder with dragging it out /dir/subdir/ then subdir has new date. But if you extract /dir directly (which includes all subdirs), then subdir has old date, but /dir has new date.

I tested here and there stuff and my conclusion is, its a mess (at least with Ark, I did not test other tools for this, because you are using Ark). As someone else said, you can use touch command to change dates to current date. This could be automated with extraction of archive and using touch command, but this gets involving, especially if you want to have it as a command in the mouse popup menu of your filemanager.

[-] [email protected] 3 points 3 weeks ago

Most archiver programs will set the modified time of a file to the modified time recorded in the archive (if present). Many archive formats support recording modification times because they were intended for backups and aim to perfectly record the original files including all data and metadata.

I also agree that this is not what I want when using GUI modification programs (in my case file-roller) but the exact options available will depend on which program you use.

[-] [email protected] 1 points 3 weeks ago

Change the file's timestamp.

[-] [email protected] 2 points 3 weeks ago

The extractor probably takes the timestamps from inside the archive

[-] [email protected] 0 points 3 weeks ago

Yes, but you can change it to whatever you like after extraction.

this post was submitted on 27 Apr 2024
13 points (93.3% liked)

Linux

44202 readers
10 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS