简体   繁体   English

Linux 命令将文件从子文件夹移动到其父文件夹

[英]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:此命令将当前文件夹的所有子文件夹中的文件(以S开头并以E结尾(即匹配S*E ))移动到当前文件夹:

mv ./*/S*E ./

For example, to move all jpg files in all subfolders to the parent folder, this would be the command:例如,要将所有子文件夹中的所有jpg文件移动到父文件夹,这将是命令:

mv ./*/*.jpg ./

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

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