6

How do I list/find all the files created on Sundays or Mondays?

How do I use the date parameter to display them?

Something like :

ls -f date + %a

or

find -type f | date +%A

or

find -type f -mtime -6

migrated from stackoverflow.com Oct 8 '12 at 14:01

This question came from our site for professional and enthusiast programmers.

7

Something like this?

find -type f -printf '%Ta\t%p\n' | egrep "^(Sun|Mon)" | cut -f 2-

Note that this uses the file's last modification time, not creation time (which, as far as I know, isn't kept anywhere)

1

In *nix operating systems there is no way to get the file creation date. mtime will give you last modification time and atime will give you last accessed time. But there is no way to get the file creation time.

If you need creation time then you have to save it in some file yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy