LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-08-2010, 08:12 PM   #1
dave247
Member
 
Registered: May 2004
Posts: 206

Rep: Reputation: 30
trying to make a Perl script that automatically copies files from a CD/DVD upon load


I would like to be able to simply put in a CD or DVD disc and have a Perl script automatically copy the data upon disc load from the disc to a folder on the local hard drive as soon as the CD/DVD drive closes.

Does anyone know where I could find an existing script, or what commands I might try to make my own? I have like 4 months of Perl, so I could probably get it eventually.

Thanks for any input

Last edited by dave247; 08-08-2010 at 08:16 PM.
 
Old 08-09-2010, 05:54 AM   #2
chiragrk
Member
 
Registered: Nov 2009
Location: India
Distribution: Xandros, Ubuntu
Posts: 74

Rep: Reputation: 16
The command to copy the contents of CD/DVD off to a file is `dd if=/dev/cdrom0 of=/home/user/mycd0.iso`. Of course, you need to find the correct device for your cdrom/dvdrom.
 
Old 08-09-2010, 06:48 AM   #3
Crisantux
LQ Newbie
 
Registered: Jul 2010
Location: Europe
Distribution: OpenSuse
Posts: 7

Rep: Reputation: 0
Question

What is your question?
  • How to detect a new CD/DVD?
  • How to start your perl script automtically?
  • How to know which content the CD/DVD has?
  • How to copy files in a perl script?
  • Where to look for example perl scripts?
Please specify.

Last edited by Crisantux; 08-09-2010 at 06:50 AM.
 
Old 08-09-2010, 10:08 AM   #4
dave247
Member
 
Registered: May 2004
Posts: 206

Original Poster
Rep: Reputation: 30
Crisantux,
I just need to know how to make a script that detects if the CD/DVD drive has been loaded with media so the script can copy the contents.

I can probably just run the script and then have a loop that runs until content has been copied.
 
Old 08-09-2010, 11:09 AM   #5
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by dave247 View Post
Crisantux,
I just need to know how to make a script that detects if the CD/DVD drive has been loaded with media so the script can copy the contents.

I can probably just run the script and then have a loop that runs until content has been copied.
Nowadays you can copy just by

Code:
cp -p -r /mnt/cdrom /some/dst/dir
.

So, unloaded CDROM typically means absence of /mnt/cdrom or its emptiness (0 size).

The question is change from loaded state to another loaded state and locking the drive while copying.
 
Old 08-09-2010, 11:36 AM   #6
dave247
Member
 
Registered: May 2004
Posts: 206

Original Poster
Rep: Reputation: 30
Sergei: good point. I think I know what I need to do now. thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script that copies files/folders doesn't work Archosz Linux - Server 1 12-04-2009 09:43 PM
make duplicate copies of files Paul Griesbaum Linux - Newbie 7 06-08-2009 10:39 AM
How to make my PERL script start automatically when my HP-UX and IBM-AIX box boots up Nings Programming 1 11-26-2008 03:43 AM
FWBuilder Help: Can't get it to load script automatically on boot puma1824 Linux - Security 3 09-11-2003 09:20 PM
how to make 'konsole' load automatically after login rvijay17 Linux - Newbie 3 04-05-2003 08:42 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration