I am trying to move all files with names starts with SML
from directory to another. Tried with
find /var/.../Images/ -name SML\\* mv /var/.../Images/Small
but doesnt work
尝试find /var/.../Images/ -name SML\\* -exec mv {} /var/.../Images/Small/ \\;
I guess you want something like this:
dir=/path/to/your/Images
mkdir -p "$dir/Small"
find "$dir" -name "SML*" -not -wholename "$dir/Small/*" -exec mv {} "$dir/Small/" \;
-not -wholename "$dir/Small/*"
-exec ...
. The alternative would be to pipe your find results to a while read
loop.-exec
, the found name can be referenced by {}
. See man find
for a lot more information.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.