Results 1 to 5 of 5

Thread: Need help with bash script to copy files from DVDs to a hard drive

  1. #1
    Join Date
    Oct 2007
    Beans
    6

    [Solved] Need help with bash script to copy files from DVDs to a hard drive

    Hi, I am trying to correct a script I want to use to automate the copy of DVDs from a cdrom to my hard drive and I just can't get it to work.

    Here it is:

    Code:
    #!/bin/bash
    
    mount /media/cdrom
    cd /media/cdrom
    cp * -r /media/cdrom /media/"Expansion Drive"/Fichiers/FR/
    
    #eject
    I use a similar script two or three years ago and the cdrom was named cdrom0. But now, event by changing the cdrom name, nothing work.

    At the beginning of the script, I get:
    mount : impossible de trouver (not able to find) /media/cdrom/ dans /etc/fstab ou /etc/mtab

    If I look in /media, I get this:

    drwxr-xr-x 2 root root 4096 2011-09-26 16:53 cdrom
    drwx------ 1 user user 4096 2011-08-17 21:27 Expansion Drive
    dr-x------ 1 user user 2048 2005-12-12 23:28 FR20051212

    cdrom seems to be identified by Ubuntu separately from the disk FR20051212 (volume name) itself.

    I tried to find an answer on Internet but the search terms are too general to get a specific answer.

    What am I not understanding?

    Thanks

    Sorry if the question looks noob, but some days, I really am!
    Last edited by okaoka; November 6th, 2011 at 02:43 PM. Reason: Solved

  2. #2
    wojox is offline I Ubuntu, Therefore, I Am
    Join Date
    Apr 2009
    Beans
    8,628

    Re: Need help with bash script to copy files from DVDs to a hard drive

    Try something like:

    Code:
    mount -t iso9660 /dev/scd0 /media/cdrom

  3. #3
    Join Date
    Oct 2007
    Beans
    6

    Re: Need help with bash script to copy files from DVDs to a hard drive

    Quote Originally Posted by wojox View Post
    Try something like:

    Code:
    mount -t iso9660 /dev/scd0 /media/cdrom
    Thank you,

    It works, but it seems that I have to mount the cdrom each time I eject a DVD. Also, it shows errors like file does not exist (but finally copies it).

  4. #4
    Join Date
    Jun 2007
    Beans
    17,337

    Re: Need help with bash script to copy files from DVDs to a hard drive

    There's nothing compelling that I've seen that says you can't use a static mountpoint & fstab entry.
    If so, assuming your drive is /dev/sr0 (d. check if need be

    Code:
    sudo mkdir /media/cdrom0; gksudo gedit /etc/fstab
    on a new line at bottom of fstab
    Code:
    /dev/sr0   /media/cdrom0   udf,iso9660 user,noauto,exec   0  0
    Restart

  5. #5
    Join Date
    Oct 2007
    Beans
    6

    Re: Need help with bash script to copy files from DVDs to a hard drive

    Quote Originally Posted by mc4man View Post
    There's nothing compelling that I've seen that says you can't use a static mountpoint & fstab entry.
    If so, assuming your drive is /dev/sr0 (d. check if need be

    Code:
    sudo mkdir /media/cdrom0; gksudo gedit /etc/fstab
    on a new line at bottom of fstab
    Code:
    /dev/sr0   /media/cdrom0   udf,iso9660 user,noauto,exec   0  0
    Restart
    Hi

    It now works.

    The drive was well /dev/sr0, as I had found out yesterday.

    I now have this in /media/:
    drwxr-xr-x 2 root root 4096 2011-09-26 16:53 cdrom
    dr-xr-xr-x 7 root root 2048 2007-10-18 21:54 cdrom0
    drwx------ 1 user user 4096 2011-11-05 22:45 Expansion Drive

    So, if I understand, cdrom and cdrom0 are just like aliases to the actual thing?

    Final version of the script (It copies the files, add the files names to a list in a file on my desktop and eject the DVD:

    Code:
    #!/bin/bash
    mount /media/cdrom0
    #cd /media/cdrom0
    volname >>~/Bureau/liste_copies.txt
    ls  /media/cdrom0  >> ~/Bureau/liste_copies.txt
    echo -e "--------- " >>  ~/Bureau/liste_copies.txt
    cp    /media/cdrom0/* -r  /media/"Expansion Drive"/Fichiers/FR/
    eject
    notify-send "Copie du DVD complétée :o)"
    Thanks a lot wojox & mc4man for your help.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •