我对如何将特定类型的文件从文件夹结构复制到LINUX机器上的文件夹感到困惑。
这是源文件夹结构的方式:
Folder_X
file1.type
file2.nottype
- Folder_Y
file3.type
file4.nottype
- Folder_P
file5.type
file6.nottype
- Folder_A
file7.type
file8.nottype
- Folder_Z
file9.type
file10.nottype
所以当我find . -iname "*.type"
在Folder_X 中做时,我得到以下输出
./file1.type
./Folder_Y/file3.type
./Folder_Y/Folder_P/file5.type
./Folder_Y/Folder_P/Folder_A/file7.type
./Folder_Z/file9.type
我想将这些.type
扩展文件复制到单个文件夹中的另一个位置,如下所示
/some/another/location/Folder_I
file1.type
file3.type
file5.type
file7.type
file9.type
任何帮助表示赞赏...感谢您的时间
试试下面的代码,
find 命令有一个 -exec 选项。
参考:https : //man7.org/linux/man-pages/man1/find.1.html
find . -iname "*.type" -exec cp {} /some/another/location/Folder_I \;
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句