3

I need a command which will list the files between given date and time (YYYYMMDDHHMMSS - format) in to a text file.

I don want to use touch command as its creating permission issue.

4

You don't need to use touch if you have a recent version of a recent version of GNU find ( >= v4.3.3 ). With that you can do:

find /media/WD/backup/osool/olddata/ -newermt 20120101T1200 -not -newermt 20130101T1400

Please note the T between day and hours.

If you want to retry using touch to create reference files for -newer: you can put those anywhere where you can write ( /var/tmp?), as long as you specify the full path to -newer. So you might still find a place where you have permissions.

  • Thanks Anthon , giving path to -newer: worked with touch! – Mano May 23 '13 at 13:42
3

With zsh:

autoload age
ls -ldrt -- **/*(e{age 2013/03/06:13:20:00 2013/05/18:11:00:00})

See:

info -f zsh --index-search=age

for details.

(note that it will be a lot less efficient than Anthon's GNU find solution as it will parse those dates, do 2 lstats for every file and sort the list of files (you can avoid that last part by adding oN to the list of globbing qualifiers; use D to include dotfiles)).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.