我有以下脚本
find . -mtime 0 -type f -exec ls -ltr {} \; | grep "$(date +%d|sed 's,^0,,g') ..:.." | while read fname; do
echo "$fname"
done
我可以打印文件细节。如何将test1.txt test2.txt文件移动到另一个目录?
输出:
[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
答案 0 :(得分:1)
# 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 \;