Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
share|improve this question
add comment

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

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

2 Answers

up vote 4 down vote accepted

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)

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.