Bash/Shell-将子目录中的所有文件移动到目标目录中?

alv*_*vas 9 unix linux bash shell move

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

thi*_*ton 14

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

find sourcedir -type f -print0 | xargs -0 mv -t target 
Run Code Online (Sandbox Code Playgroud)

man mv 提供更多细节.


Joh*_*n P 7

尝试这样的事情:

find sourcedir -type f -exec mv {} targetdir \;  
Run Code Online (Sandbox Code Playgroud)