0

Can't seem to find a way to view files in a folder by date added. I only see: modified, accessed, and recency and none solve my problem.

Edit: GNOME nautilus 3.26.3

I'd like to do this from the file manager and not the command line.

Cepheus
  • 101
  • 5
  • I see first modified option in nautilus! – George Udosen Dec 23 '18 at 15:06
  • 2
    Traditionally, Unix and Unix like systems do not store a file creation timestamp. (The reasoning is that such a timestamp is at best useless and at worst misleading; it tells you nothing about the data in the file.) Some newer filesystems (such as the ubiquitous Ext4) do store file birth dates, but by and large Unix utilities don't offer the possibility to view or use them. If you absolutely need them, you may use the debugfs utility to view file creation dates. – AlexP Dec 23 '18 at 15:38
  • @AlexP I find it useful because if I download a bunch of files, I'd like to be able to view them by the date/time of download. – Cepheus Dec 24 '18 at 07:53
  • @GeorgeUdosen I'm using GNOME nautilus 3.26.3 and can't see that option. Not sure it would solve the problem either. – Cepheus Dec 24 '18 at 08:00

2 Answers2

0

You can do something like this:

find . -mindepth 1 -maxdepth 1 -ctime -3

The "." means the current directory. You can replace the "." with a path to another directory.

mindepth and maxdepth of 1 will limit the list of files to just ones in that directory. If you want to see files in subdirectories too, then take those out.

ctime is the create time. you can also use mtime which means last modified time or atime which means last accessed time. The number after is in days (e.d., 3 days). -3 means less than three days. 3 means exactly 3 days. +3 means more than 3 days. You can use all three times at once:

find . -mindepth 1 -maxdepth 1 -ctime -3 -mtime -3 -atime -3
Eric Mintz
  • 2,516
  • 12
  • 24
  • 4
    Actually ctime is the timestamp the inode was last changed. For example, chmod +x changes a file's ctime while leaving its mtime alone. – PerlDuck Dec 23 '18 at 17:21
0

Linux has had birthdate of a given filename in place for a long time with the stat command:

$ stat /home/$USER/.bashrc
  File: '/home/rick/.bashrc'
  Size: 9161        Blocks: 24         IO Block: 4096   regular file
Device: 10306h/66310d   Inode: 923399      Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/    rick)   Gid: ( 1000/    rick)
Access: 2018-12-23 06:33:46.768933188 -0700
Modify: 2018-12-23 06:33:40.912884555 -0700
Change: 2018-12-23 06:33:40.924884655 -0700
 Birth: -

However as you can see the filename /home/$USER/.bashrc has a blank birthdate. Related question: When is Birth Date for a file actually used?

You can setup a function to list the filename's birthdate though:

$ get_crtime ~/.bashrc
/home/rick/.bashrc  Sun Dec 23 11:39:37 2018