Reputation: 3514
I have following script
find . -mtime 0 -type f -exec ls -ltr {} \; | grep "$(date +%d|sed 's,^0,,g') ..:.." | while read fname; do
echo "$fname"
done
And I am able to print file detail. How can I move test1.txt test2.txt files to another directory?
Output:
[nca@ldc039 failure]$ . ../../scripts/retryFailedFiles.sh
-rwxrwxr-x. 1 nca nca 0 Feb 29 16:16 ./test1.txt
-rwxrwxr-x. 1 nca nca 0 Feb 29 16:16 ./test2.txt
Upvotes: 0
Views: 1493
Reputation: 408
# You can use the option -1tr instead -ltr :
find . -mtime 0 -type f -exec ls -1tr {} \; | while read fname; do
echo "$fname"
mv $fname newfolder
done
# Or, by using the following commande :
find . -mtime 0 -type f -exec mv {} newfolder \;
Upvotes: 2