简体   繁体   English

消除子文件夹,将所有文件移动到一个文件夹中

[英]Eliminating subfolders to move all files into one folder

I have a folder that contains 32 folders, each with several image files. 我有一个包含32个文件夹的文件夹,每个文件夹包含几个图像文件。 I would like to move all of these image files into one main folder. 我想将所有这些图像文件移动到一个主文件夹中。 I know how to do that manually, folder by folder. 我知道如何手动逐个文件夹地执行此操作。 Is there an automated command-line way to do that? 有自动的命令行方式吗? I have Crunchbang Waldorf, and usually use PCmanFM as a file manager. 我有Crunchbang Waldorf,并且通常使用PCmanFM作为文件管理器。

/ * /代表目录。

mv /path/from/*/*.jpg /path/main/

if all these images have one extension, for instance .jpg : 如果所有这些图像都有一个扩展名,例如.jpg

find /directory/You/Want/To/Search -name "*.jpg" -exec cp -t /destination/directory {} +

Note: just make sure that all these images have one unique name otherwise this command would break 注意:只需确保所有这些图像都有一个唯一的名称,否则此命令将中断

UPDATE: 更新:

if you don't know what are the images extensions you could just do that one: 如果您不知道图像扩展名是什么,可以执行以下操作:

 find /directory/You/Want/To/Search -regex ".*\.\(jpg\|gif\|png\|jpeg\)" -exec cp -t /destination/directory {} +

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

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