简体   繁体   中英

Linux command to move files from subfolders into their parent folders

i need some help if possible. I need to know how i could find and move all files from subfolders into their parent folders

eg:

from

path/to/folder/x1/xx1/file1
path/to/folder/x2/xx2/file2

to

path/to/folder/x1/file1
path/to/folder/x2/file2

Thanks

maybe you can try this command

mv path/to/folder/x1/xx1/file path/to/folder/x1/

This command moves the files in all subfolders of the current folder, starting with S and ending in E (ie matching S*E ), to the current folder:

mv ./*/S*E ./

For example, to move all jpg files in all subfolders to the parent folder, this would be the command:

mv ./*/*.jpg ./

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