Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i want to transfer the myfiles folder from CD to Documents in a more decent way of transferring. I think creating an executable bash file is better. this bash file when clicked will allow the transfering of files. How will I create this?

share|improve this question
Wouldn't it be easier to just open up two file manager windows and drag the folder from one to the other? Writing a script would take more work, since you'd have to work out the mount point's name, which I think is derived from the CD's label, and use that. It could be done, but I don't think there'd be to much of a benefit to doing so. – Scott Severance Mar 14 '13 at 2:01

If you want to use script for that, then write a script like that:

echo "Transferring myfiles folder from CD to Documents..."
cp /media/(((CD Name)))/myfiles /home/(((username)))/Documents
echo "Transferred Successfully"

All done.

share|improve this answer

The following bash script detects the mount point of the first CD/DVD drive and copies the myfiles folder to the Documents folder. If a folder Documents/myfiles exists already, the contents will be merged. Files with equal name will be overwritten.

MOUNTPOINT=$(df | grep "/dev/sr" | head -n 1 | sed -e "s/.*%\s*\(.*\)/\1/g")
cp -r "$MOUNTPOINT/myfiles" "$HOME/Documents"

If, however, you want to update the contents of the two folders regularly, you are probably better off using rsync instead of cp, for example like this:

rsync -rtu --delete "$MOUNTPOINT/myfiles" "$HOME/Documents"

If you want to use rsync, you should consider the help page via rsync --help.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.