简体   繁体   English

Bash将基于列表的多个子目录(包括文件)移动到目标目录

[英]Bash move multiple subdirectory (including files) based on a list to a targe directory

I have a directory that contains many subdirectories, each of which has several files. 我有一个包含许多子目录的目录,每个子目录都有几个文件。

But I only need some of the subdirectories (and the included files). 但是我只需要一些子目录(和包含的文件)。 And I have a list of the subdirectory names that I need to move. 我有一个需要移动的子目录名称的列表。

How I do move the needed subdirectories to target directory based on the list in bash shell? 如何根据bash shell中的列表将所需的子目录移动到目标目录?

Thanks 谢谢

假设您的意思是将所有子目录都移动到单个目标目录,则应执行以下操作

cat subdirlist | xargs -i mv {} targetdir

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM