Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of files after a date

Tags:

bash

I want to get all files after a specific date. I tried with:

ls -ltr | awk {'print $6'} | sed s/-//g | awk {'if ($1-20110415 > 0 )  {print $1}'}

which works 50% fine. The last command prints only date of file. How to print date of file and filename? In the awk $8 is the filename, but I don't know how to transfer till last print in the command line.

Thank you, Luke

like image 835
Luke Avatar asked Apr 26 '11 21:04

Luke


People also ask

How do you list files and folders with respective time?

ls command ls – Listing contents of directory, this utility can list the files and directories and can even list all the status information about them including: date and time of modification or access, permissions, size, owner, group etc.


1 Answers

Try find command like this:

find /my/path -mtime -1  # to get files modified in last 1 day

find /my/path -mtime -1.5  # to get files modified in last 1.5 day
like image 189
anubhava Avatar answered Oct 15 '22 19:10

anubhava