[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Sheflug] Scripting



On 13-Dec-03 rhinecourt [at] btopenworld.com wrote:
> 
> I have alot of disks, which I would like to get the names of direcories
> and files etc off.  I was thinking of learning a programming language
> so as I could write a script to automate the task.  Would perl be easy
> enough to learn to do the job?  Or would a simple bash script or
> something be better?  Any feedback would be great...cheers

Supposing it's a lot of DOS floppies (you don't say what they are)
the following simple bash script will do this kind of job:

1. Put the first disk in the drive

2. Enter the following commands [See NOTE below]:

   read ; echo $REPLY > temp ; while true
   do mdir -/ -a -f a: >> temp
   echo "NEXT DISK PLEASE"
   read ; echo $REPLY >> temp
   done

3. With the first disk, nothing will happen until you enter the
   name you want to call this disk. Enter this name (it can be
   several words if you wish) and press RETURN.

4. When it has finished this disk (drive activity stops, and
   "NEXT DISK PLEASE" appears on screen), take out the old disk
   and put in a new disk, enter its name, and press RETURN.
   Repeat for all disks.

5. When finished, press Ctrl-C

You will then be back at the command prompt, and you will have
the MSDOS directories for all the floppies in the file temp,
under the disk names you have given.

NOTE: I've put in options (see 'man mdir') to "mdir" as follows:
  -/ recursive listing (goes down the directory tree on the floppy);
  -a also lists "hidden" files (if any)
  -f bypasses computation of free space on diskette
Omit any you are not interested in.

The above commands (at 2) could be saved in a script file.
However, doing it for the first time as above will make it clearer
to you where you are in the process.

Be careful (at 4 and at 5) that you don't take the disk out before
it has finished reading the directory (i.e. make sure you wait for
"NEXT DISK PLEASE").

Hope this helps!
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding [at] nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 14-Dec-03                                       Time: 11:35:48
------------------------------ XFMail ------------------------------
___________________________________________________________________

Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html

  GNU the choice of a complete generation.