Problem copying hidden files with cp

Hi. I’m cleaning off space on my sda drive, so:
I’m backing up my personal home directories from an old 10.3 installation on the the origin drive sda8 to a backup drive sdb where I’ve made a directory /JOHN103. The command is this, issued in a console as root user:

cp -a /mnt/sda8/john/* /mnt/sdb2/JOHN103

That works fine except it doesn’t copy the hidden files. I thought the “-a” option would copy hidden files, after all “-a”, the archive option, means “-dpR”.

What am I missing?

Thanks
Swerdna

Maybe thismay help.
did a quick google and got loads of hits

Geoff

The problems is that the wildcard * only matches non-hidden files.

To get what you want, copy the directory:

cp -a /mnt/sda8/john/. /mnt/sdb2/JOHN103

Notice the . after john/.

From Geoff I hunted down this solution:
shopt -s dotglob
cp -a /mnt/sda8/john/* /mnt/sdb2/JOHN103
shopt -u dotglob
But clearly Ken’s is the way to go.

Thanks guys.