简体   繁体   English

Linux:用Grep和CP查找。 需要修饰符帮助以保留目录结构

[英]Linux: Find with Grep and CP. Need assistance with the modifier to preserve directory structure

The issue: We have hundreds of folders, each with hundreds of images.问题:我们有数百个文件夹,每个文件夹都有数百张图像。 We need to copy the first 5 images into a destination folder.我们需要将前 5 个图像复制到目标文件夹中。

This is the command I've managed to construct:这是我设法构建的命令:

find . -name '000[0-5]*' -exec cp --parents {} /volume1/WORKING/Covers/disk6/africa{} \;

returns this error message:返回此错误消息:

cp: with --parents, the destination must be a directory

I can't seem to find the correct modifier.我似乎找不到正确的修饰符。 What am I missing?我错过了什么?

Thanking you kindly谢谢你

Suggesting to try:建议尝试:

 cp $(find . -type f -name '000[0-5]*') /volume1/WORKING/Covers/disk6/africa

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

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