How to display the updated files within the specific period of date by "ls" command on Linux terminal

Note that your environment may differ from my environment(lubuntu). For example, if you want to find the updated files from Aug 15 to Aug 20 in 2024, then
1. move to that directory (e.g. "abcde" directory) by "cd" command.
$ cd abcde
2. Execute the next "ls" command.
$ ls -ltr | awk '$6 == "8月" && ($7 >=15 && $7 <= 20) && $8 = 2024 {print $6"-"$7"-"$8,$9}'
If you want to find the updated files before Aug 5 or after Aug 25 in 2024, then
3. execute the next "ls" command.
$ ls -ltr | awk '$6 == "8月" && ($7 <=5 || $7 >= 25) && $8 = 2024 {print $6"-"$7"-"$8,$9}'
See also,
How to get only files created after a date with ls? - Stack Exchange Confusing use of && and || operators - Stack Exchange.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.