Berawal dari keinginan copy semua file kecuali file/folder tertentu melalui command line, akhirnya tahu beberapa trik yang cukup berguna. Yaitu
cp -rp !(Default.png) /source /dest
artinya: copy semua file termasuk folder dari folder source ke folder dest kecuali Default.png
Kalau munculnya error :
bash: !: event not found
Berarti butuh aktifkan extglob :
sudo shopt -s extglob
detail apa arti detail perintah diatas bisa dipelajari disini.
Oh ya untuk pembuatan script bash jangan lupa kasih script berikut di bagian paling atas :
#!/usr/bin/bash
shopt -s extglob
Untuk lokasi bash disesuaikan saja, bisa dicari lokasinya dengan perintah "which bash"
Alternatif yang lain adalah pakai find
# Simple, if src/ only contains files:
find src/ ! -name Default.png -exec cp -t dest/ {} +
# If src/ has sub-directories, this omits them, but does copy files inside of them:
find src/ -type f ! -name Default.png -exec cp -t dest/ {} +
# If src/ has sub-directories, this does not recurse into them:
find src/ -type f -maxdepth 1 ! -name Default.png -exec cp -t dest/ {} +