Bash or Perl example: copying data from a CD/DVD, to hard drive.
Seeking a decent Perl or Bash script or hack used to copy data from a CD/DVD to local or even remote hard drive/storage.
Thanks! |
Quote:
|
From perl or shell
Mount the drive. Copy the data. unmount the drive |
Examples, please! Let me elaborate. Let's say you're copying items from a CD/DVD, to be later imported to say, MySQL, or something of the sort.
What's a good script that would copy the data, from the CD/DVD, into a directory in a sort of format like this: cp -v /<data from CD/DVD> <your initials>-<the date>-<the directory name> A pretty format that could be later imported to MySQL, or something of that nature. Just looking for ideas. Thanks! |
Quote:
For example, who is "you" in <your initials> ? Current user ID ? User ID of the file owner on CD/DVD ? What is <the date> ? I.e. file modification date on CD/DVD ? Current date ? Date entered on command line ? What is <the directory name> ? I.e. what directory are you talking about ? Where should its name come from ? Why are you asking about CD/DVD ? How data on mounted CD/DVD is different from any other data on disk (except for being read-only) ? ... Have you read 'man cp' ? Do you know how 'cp -r ...' works ? |
Quote:
- The "date" would be the current date. - The directory name would be derived from the directory on the CD/DVD. So for instance: US_EN_Speaker_data_vol1 This is a typical directory name that I find on a lot of the data CD's and DVD's that I encounter. - It's not the mounting of the CD's and DVD's I'm really worried about. I'm using GNOME, so any disc that I pop in gets auto-mounted. I just want to open a shell, and fire up a script that copies the data right from the disc. - Yes, I know what cp (-r) does. :-) Thanks! |
Quote:
Code:
chomp(my $user = `whoami`); Read about 'File::Spec', 'File::Basename', 'File::Path', 'Cwd' Perl modules for efficient dealing with paths. Regarding date - look for "Perl date time modules". |
And, of course,
Code:
perldoc -f opendir |
All times are GMT -5. The time now is 02:40 PM. |