I’m copying all subdirectories with its contents to my current directory as follows:
cp -r dirToCopy/* .
But in the folder
dirToCopy, there is one subfolder called
dirNotToCopy which should not be copied.
How can I filter that particular folder out of my expression?
Use extended globbing:
shopt -s extglob cp -r dirToCopy/!(dirNotToCopy) .
Answered By – choroba