I have a couple of sub-folders mounted on /mnt. One is /mnt/data, and the other is /mnt/1804iso. The /data includes data folders and files mounted from another disk, and /1804iso includes a mounted ISO file whose contents I wanted to copy to folder /media/benny/0EB4-95E2/ which is a mounted flash-drive.
So I opened bash and typed sudo cp -Rn /mnt/1804iso/.* /media/benny/0EB4-95E2/
. I would normally have omitted the period before wildcard asterisk /*/, but if I do that then a hidden file within the ISO does not copy over. So with this command one strange thing occurred. After copying over the ISO files correctly, then it started to copy over the /mnt/data folders and files as well. I cannot see why that can happen as there is no reference to that folder, unless my understanding of the command part /mnt/1804iso/.*
is totally flawed.
Could someone kindly explain why my /mnt/data
folder was included for copying?
command .*
acts on the parent directory..
a reference to its parent directory.shopt -s dotglob
, will make*
also match most files starting with a.
, but not.
and..
.