문제

Im trying to find a set number of files in a directory and then copy them to another directory using the find and cp command.

this is the command i have so far:

find /usr/share -name a* -type f -group admin -size -10240c | cp /usr/share/ ./thecopy/

Now it finds the files but does not copy the files to the location I'm trying to send them but finds the files in question. Any suggestions please?

올바른 솔루션이 없습니다

다른 팁

find /usr/share -name a* -type f -group admin -size -10240c -exec cp {} ./thecopy/\;

That won't recreate any directory structure under thecopy. But will copy the files it finds to your directory needed

Try something like:

find /usr/share -name a* -type f -group admin -size -10240c | cp {} ./thecopy/ \;

{} is the placeholder for the files that match your criteria

If you want to retain the directory structure you can try something like:

find /usr/share -name a* -type f -group admin -size -10240c | rsync -av {} ./thecopy/ \;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top