Linux Copy all the files including subdirectories from DVD / Floppy / CD / Other directory (recursive copy)
Q. How do I copy all the file including subdirectories from DVD disk mounted at /mnt/dvd to /home/tom at a shell prompt under CentOS Linux?
A. You need to use cp command to copy SOURCE to DESTINATION or multiple SOURCE(s) to a DIRECTORY. Gnu cp command has -a option which copy directories recursively while preserving the file attributes such as mode,ownership,timestamps and security contexts, if possible additional attributes such as links et all.
cp command syntax
Use the following syntax:
cp -a {/path/to/source} {/path/to/destination}
For example copy all files including subdirectories from /mnt/dvd/data to /home/tom/data, enter:
$ cp -a /mnt/dvd/data/* /home/tom/data
OR
$ cp -av /mnt/dvd/data/* /home/tom/data
Recursively copy entire directories
Many other command (including cp) support -r or -R option for copying file recursively. For example scp secure network copy command:
$ scp -r *.cpp remote_user@server.nixcraft.in:~
OR use cp command locally (instead of -a option):
$ cp -r *.cpp /path/to/dest
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Other Helpful FAQs:
- Linux Copy File Command ( cp command examples )
- Linux or UNIX securely copy files across a network computer
- Linux or UNIX change file permissions recursively ( conditional )
- Restore Selected Files From Secondary Backup Hard Disk
- How to Linux re apply or restore SELinux security labels context
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!



Recent Comments
Yesterday ~ 1 Comment
Yesterday ~ 3 Comments
Yesterday ~ 2 Comments
Yesterday ~ 3 Comments
Yesterday ~ 13 Comments