When I do a ls -lt I get a list of files by date modified from newest to oldest. I would like to be able to copy some files to another directory using a date last modified range (i.e. Apr 30 - May 13) How could I do this?
Thanks,
Joe
When I do a ls -lt I get a list of files by date modified from newest to oldest. I would like to be able to copy some files to another directory using a date last modified range (i.e. Apr 30 - May 13) How could I do this?
Thanks,
Joe
find has an option in most versions to pick files by age, or you could simply note the first and last files in the range and pipe ls -t output to a sed script to pick out that range.
You can also tell find to find files that are newer than one file.
find . -type f -newer timestamped_file -print
will print all the files that were modified since the last time timestamped_file was modified.
man find reveals all.
I ended up using just adding a -exec cp {} ./mydir \; to the end of the find command and it worked like a charm. Thanks for help!
hi
you can use find command with -mtime flag
like
find . -mtime (-n or n or +n) | xargs cp dirname
-n for files modified in last n days
n for files modified exactly on last nth day
+n fro files modifed before last nth day
Abhishek Gera