Copy files of specific type from parent to child folder
I can successfully copy the file from the folder "objects" (the directory I'm in) to it's subfolder "access" with this code in Terminal.
find . -name *.pdf -exec cp {} ./access \;
But the code is also looking into the "access folder" for files to copy and I get this message
cp: ./access/cuid12368.pdf and ./access/cuid12368.pdf are identical (not copied).
Is there a way to not have it look into the "access" folder for files to copy?
The find
command is not necessary for this operation. Use:
cp *.pdf access/.
This copies all PDF files to the access
subfolder and is much prettier and simpler than the equivalent find
command.