2
我已经创建了以下脚本,用于将旧日文件从源目录定义到目标目录。它工作完美。bash脚本改进
#!/bin/bash
echo "Enter Your Source Directory"
read soure
echo "Enter Your Destination Directory"
read destination
echo "Enter Days"
read days
find "$soure" -type f -mtime "-$days" -exec mv {} "$destination" \;
echo "Files which were $days Days old moved from $soure to $destination"
该脚本移动文件很大,但它也移动源子目录的文件,我不想。 它不应该采取子目录文件。我怎样才能做到这一点 ?
,它应该补充? –
我的查找命令应该找到-maxdepth 1“$ soure”-type f -mtime“ - $ days”-exec mv {}“$ destination”\; 什么? –
not working给出以下错误find:warning:在非选项参数-type后指定了-maxdepth选项,但选项不是位置的(-maxdepth会影响在它之前指定的测试以及在它之后指定的测试)。请在其他参数前指定选项。 –