[英]Copy files (of specific extension) from a folder structure to another folder
I am confused to how to copy a specific type of files from a folder structure to simply a folder on a LINUX machine.我对如何将特定类型的文件从文件夹结构复制到LINUX机器上的简单文件夹感到困惑。
This is how the source folder structure is:源文件夹结构如下:
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
So When I do find. -iname "*.type"
所以当我find. -iname "*.type"
find. -iname "*.type"
in Folder_X , I get following output find. -iname "*.type"
在Folder_X ,我得到关注 output
./file1.type
./Folder_Y/file3.type
./Folder_Y/Folder_P/file5.type
./Folder_Y/Folder_P/Folder_A/file7.type
./Folder_Z/file9.type
I want to copy these .type
extension files to another location in a single folder as this我想将这些.type
扩展文件复制到单个文件夹中的另一个位置,因为
/some/another/location/Folder_I
file1.type
file3.type
file5.type
file7.type
file9.type
Any help is appreciated... Thank you for time任何帮助表示赞赏...谢谢您的时间
try below code,试试下面的代码,
The find command has a -exec option. find 命令有一个 -exec 选项。
ref: https://man7.org/linux/man-pages/man1/find.1.html参考: https://man7.org/linux/man-pages/man1/find.1.html
find . -iname "*.type" -exec cp {} /some/another/location/Folder_I \;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.