I've been attempting to copy all .wav
files on my system (OS X based) into one folder .. strangely nothing is getting copied into the new folder.
#!/bin/sh
find . -name /Applications/*.wav -exec cp {} /Users/myhouse/Downloads/audio_pool/wav/ ;
is there a risk of getting a loop going (ie it finds files and continues to just copy them into the folder)
I also tried this format
for f in /*.wav; do cp "$f" /Users/myhouse/Downloads/audio_pool/wav/.; done
The glob needs to be escaped to have find
interpret it rather than the shell. Move the /Applications/
path to the front: -name
is only matching the file name, not the full path. Make sure to quote the ;
at the end, too.
find /Applications/ -name '*.wav' -exec cp {} /Users/myhouse/Downloads/audio_pool/wav/ ';'
^^^^^^^^^^^^^^ ^^^^^^^ ^^^
directory quoted glob quoted