Bash/ shell—将子目录中的所有文件移动到目标目录



如何bash命令或shell脚本将所有文件从子目录移动到Linux中的一个目标目录?

如果您使用的是GNU mv,那么-t选项(目标目录)非常有用:

find sourcedir -type f -print0 | xargs -0 mv -t target 

man mv给出了更多的细节

试试这样:

find sourcedir -type f -exec mv {} targetdir ;  

最新更新