what do I need?

Martin McCormick martin at dc.cis.okstate.edu
Tue Apr 20 16:44:41 UTC 2010


	This topic is now over a month old but I was catching up
on this list and found it. Here is a little shell script I wrote
for transferring magazines after having downloaded them.
Real Talking Books are handled precisely the
same way so don't let the reference to magazines stop you.

	The unarchive function is called each time the for
statement executes.

	As always, be careful and read this script first before
running it. I did setup an entry in /etc/fstab to facilitate the
mounting of the flash drive so you will need to do something
similar before you are ready to try this. Cut here.


#! /bin/sh
unarchive ()  {
 unzip $MAGDIR/$MAGFILE
}
#Stop right here if you can't mount /flash.
mount /flash || exit 1
#Go to the directory where you store bard downloads.
cd $HOME/magazines
MAGDIR=`pwd`
cd /flash
#Uncomment the next line if you want to remove all previous books from the drive.
#This is potentially a very dangerous command so be forewarned.
#rm -r -f *
     for MAGFILE in `ls -t $MAGDIR/`; do
echo $MAGFILE
#Shorten the book name
     MAGFILEDIRNAME=`echo $MAGFILE |sed 's/\.zip//g'`
mkdir -p $MAGFILEDIRNAME
cd $MAGFILEDIRNAME
#unzip that book in to that directory.
unarchive
#Go up one level to the flash drive's root directory.
#This is comparable to the popd command in bash.
cd ../
done
exit 0

Cut here.

Janina Sajka writes:
> You mean the NLS player can't handle its own unzipping? How quaint!
> 
> BTW: Since the question was about Linux, let me answer that there is an
> unzip command in Linux. You don't need Windows to unzip. And, of course,
> Linux is perfectly capable of mount USB drives, so you should be able to
> copy files straight across to that drive.
> 
> Janina




More information about the Blinux-list mailing list