BASH copy all files except one
Should be as follows: cp -r !(Default.png) /dest If copying to a folder nested in the current folder (called example in the case below) you need to omit that directory also: cp -r !(Default.png|example) /example
Should be as follows: cp -r !(Default.png) /dest If copying to a folder nested in the current folder (called example in the case below) you need to omit that directory also: cp -r !(Default.png|example) /example
Adding to Eric Jablow’s answer, here is a possible solution (it worked for me – linux mint 14 /nadia) find /path/to/search/ -type f -name “glob-to-find-files” | xargs cp -t /target/path/ You can refer to “How can I use xargs to copy files that have spaces and quotes in their names?” as well.
–parents is copying the directory structure, so you should get rid of that. The way you’ve written this, the find executes, and the output is put onto the command line such that cp can’t distinguish between the spaces separating the filenames, and the spaces within the filename. It’s better to do something like $ find … Read more
rsync is fast and easy: rsync -av –progress sourcefolder /destinationfolder –exclude thefoldertoexclude You can use –exclude multiples times. rsync -av –progress sourcefolder /destinationfolder –exclude thefoldertoexclude –exclude anotherfoldertoexclude Note that the dir thefoldertoexclude after –exclude option is relative to the sourcefolder, i.e., sourcefolder/thefoldertoexclude. Also you can add -n for dry run to see what will be … Read more
mkdir -p “$d” && cp file “$d” (there’s no such option for cp).