【发布时间】:2014-07-14 17:39:33
【问题描述】:
read source
read destination
destination=$(cd -- "$destination" && pwd)
cd -- "$source" &&
find . -name '*.ext1' -o -name '*.ext2' -exec sh -c '
mkdir -p "$0/${1%/*}"
mv "$1" "$0/$1"
' "$destination" {} \;
我有上面的代码来查找文件,然后尝试保留目录结构。但问题是它没有找到并移动我请求类型的所有文件 - 有什么问题?它似乎错过了不在最低目录级别的文件。
Source/
\->File (misses this)
\->Folder/
\->File (finds/moves this)
【问题讨论】: