We can copy some file by extensions like this:
cp *.txt ../new/
but how can I copy all files that have no extension?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
The answer from @ubaid-ashraf is almost there. The way to specify file with no extension, in
ksh would be:
cp -- !(*.*) /new/path/
so that any file with dot in file name is skipped.
For that to work in
bash, you need to enable the
extglob option (
shopt -s extglob) and the
kshglob option in
set -o kshglob).