简体   繁体   中英

Eliminating subfolders to move all files into one folder

I have a folder that contains 32 folders, each with several image files. 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.

/ * /代表目录。

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

if all these images have one extension, for instance .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 {} +

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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