linux中同时移动多种格式文件

119 阅读1分钟

同时移动多种文件类型

方法一

假设 rumenz 的目录中有多种类型的文件,如 .pdf .doc .mp3 .mp4 .txt 等,我们先来查看 rumenz中的内容:

> ls rumenz/
123.pdf 456.pdf rumenz.mp4 rumenz.mp3 1.txt

将 doc,pdf 和 txt 文件一次性移动到另一个名为tmp 的目录中,你可以使用如下命令:

> mv rumenz/*.{doc,pdf} tmp/

方法二

然后将选择的文件类型移动到目标目录tmp:

> cd rumenz
> mv *.doc *.txt tmp/

移动特定扩展名的所有文件,例如 .txt

> mv rumenz/*.txt tmp/