Please don't give me a solution that leverages other commands like grep or ls or sed.
I want to know whether cp with a regular expression can do this.
cp(1) itself has no "regular expression" support; the functionality you're depending on is probably Pathname Expansion (globbing) in Bash. Check the bash(1) manpage to find extglob syntax like this:
shopt -s extglob
cp !(abc*) destination/
cp -t elsewhere [^a]* a[^b]* ab[^c]*
Note that this:
bash not cp, andabc*If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With