I am using this for d in ./*/ ; do (cd $d && cp -R ../lib . ); done in a shell script to copy lib folder in all subfolder inside my parent directory . But the lib folder also getting copied inside lib . How to avoid that ?
How to copy using for loop?
command line;files;cp
Without extglob:for d in */ ; do    if [ $d != lib/ ]; then        cp -R lib $d    fidoneOr just delete it afterwards... (well, unless lib/lib exists beforehand!)for d in */; do cp -R lib $d; donerm -r lib/lib(Somewhat amusingly, GNU cp says cp: cannot copy a directory, 'lib', into itself, 'lib/lib', but does it anyway.)