I want to copy the last three months' files from one directory to another directory, but I could find only listing the files by using the following command.
find . -mtime -90 -ls
How can I copy the files by using -mtime?
Use the -exec option for find:
find . -mtime -90 -exec cp {} targetdir \;
-exec would copy every result returned by find to the specified directory (targetdir in the above example).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With