I want to find all *.pdf files recursively in directory /dir
In that dir there are specific files such as /dir/1/2.pdf [modified today], /dir/2/3.pdf [modified today], /dir/4/4.pdf [from yesterday]
IN that case I only want files that were modified today so: 2.pdf and 3.pdf
I also want to move those files to directory called /pdf/
I found that I can find all files in current directory modified today with:
find -maxdepth 1 -type f -mtime -1
How can I find files from today in subdirectories and move them to /pdf/ dir?
Thanks!!! Adam
Remove -maxdepth 1 from your find command to find files in subdirectories and use -exec to move those to the target directory:
find /dir -type f -mtime -1 -exec mv {} /pdf \;
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