1

I have a lot of files, of which I need to show only those created in the last 3 hours, and sort this list by date. I tried to do it with the following command:

find /root/shell/copy/ \( -type f -mmin +180 \) | get_crtime | xargs ls -t | head -1

get_crtime is a function created for .bashrc as shown in this example to find out the date of creation for a file.

How can I use the command correctly?

enter image description here

Par4o
  • 11
  • What is the end goal? Are you sure you want creation time rather than modification time? – steeldriver Mar 03 '22 at 11:59
  • @steeldriver my end goal is to upload files created in more than 3 hours, and from the resulting list to sort by the newest, it is the creation date that interests me – Par4o Mar 04 '22 at 05:18
  • But why do you believe that you need creation time? It's not widely used in Linux, and your find -mmin is going to return files based on modification time anyhow. – steeldriver Mar 04 '22 at 13:56

0 Answers0