Skip to main content
added 62 characters in body
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

The pattern /mnt/1804iso/.* expands to, amongst possibly other things, the directory entry /mnt/1804iso/.., which is the same as /mnt. I'm geussing that's why it started copying /mnt/data.

In this case, I would just use rsync:

rsync -ai /mnt/1804iso/ /media/benny/0EB4-95E2

This would copy all of /mnt/1804iso, including hidden files, into /media/benny/0EB4-95E2. Leaving off the / at the end of the source directory would create a 1804iso directory below the target directory.

Alternatively, enable the dotglob shell option in bash with shopt -s dotglob to make * match hidden names as well as non-hidden names (but not . or ..). Then use

cp -Rn /mnt/1804iso/* /media/benny/0EB4-95E2/

The pattern /mnt/1804iso/.* expands to, amongst possibly other things, the directory entry /mnt/1804iso/.., which is the same as /mnt. I'm geussing that's why it started copying /mnt/data.

In this case, I would just use rsync:

rsync -ai /mnt/1804iso/ /media/benny/0EB4-95E2

This would copy all of /mnt/1804iso, including hidden files, into /media/benny/0EB4-95E2. Leaving off the / at the end of the source directory would create a 1804iso directory below the target directory.

Alternatively, enable the dotglob shell option in bash with shopt -s dotglob to make * match hidden names as well as non-hidden names (but not . or ..).

The pattern /mnt/1804iso/.* expands to, amongst possibly other things, the directory entry /mnt/1804iso/.., which is the same as /mnt. I'm geussing that's why it started copying /mnt/data.

In this case, I would just use rsync:

rsync -ai /mnt/1804iso/ /media/benny/0EB4-95E2

This would copy all of /mnt/1804iso, including hidden files, into /media/benny/0EB4-95E2. Leaving off the / at the end of the source directory would create a 1804iso directory below the target directory.

Alternatively, enable the dotglob shell option in bash with shopt -s dotglob to make * match hidden names as well as non-hidden names (but not . or ..). Then use

cp -Rn /mnt/1804iso/* /media/benny/0EB4-95E2/
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

The pattern /mnt/1804iso/.* expands to, amongst possibly other things, the directory entry /mnt/1804iso/.., which is the same as /mnt. I'm geussing that's why it started copying /mnt/data.

In this case, I would just use rsync:

rsync -ai /mnt/1804iso/ /media/benny/0EB4-95E2

This would copy all of /mnt/1804iso, including hidden files, into /media/benny/0EB4-95E2. Leaving off the / at the end of the source directory would create a 1804iso directory below the target directory.

Alternatively, enable the dotglob shell option in bash with shopt -s dotglob to make * match hidden names as well as non-hidden names (but not . or ..).