[Tutor] Perl refugee
Rich Pinder
rpinder@usc.edu
Fri, 26 Apr 2002 07:59:32 -0700
--------------8F9C34CC7747D2EB44498E3A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Ok... i'm a zope user (not a good one), and long time perl user.
Each time i get a little 'utility' type project, I think "A ha.. I'll
use Python this time" - then the time gets low, i never get around to
it, and say "heck, i'll just do it in Perl".....
So this morning I said no - wanna get the first one under my belt !
realized the machine i'm using doesnt have Python - so loading it now.
.... here's my goal.....
I need to copy 80,000 files from one directory and put them in one of 20
other directories. I'm into chaper 12&13 in the pyton book, and am sure
I can get the looping structure over the directory listing....
But to progam the logic to decide where the files go, I need substring
parsing of the file names (think thats easy) PLUS something like a CASE
statement. I don't see the CASE statement anywhere.
So will i have to use a bunch of cludgy if/then statements, or is there
something more elequent...
if subval > "0001" and subval < "0010" :
<filecopyingsteps>
elif subval > "0009" and subval < "0020" :
<filecopyingsteps>
........
Thanks
(python 2.2.1 is installed...whoo hoo!)
rich pinder
usc school of medicine
--------------8F9C34CC7747D2EB44498E3A
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Ok... i'm a zope user (not a good one), and long time perl user.
<br>Each time i get a little 'utility' type project, I think "A ha..
I'll use Python this time" - then the time gets low, i never get around
to it, and say "heck, i'll just do it in Perl".....
<p>So this morning I said no - wanna get the first one under my belt !
<p>realized the machine i'm using doesnt have Python - so loading it now.
<p>.... here's my goal.....
<p>I need to copy 80,000 files from one directory and put them in one of
20 other directories. I'm into chaper 12&13 in the pyton book,
and am sure I can get the looping structure over the directory listing....
<p>But to progam the logic to decide where the files go, I need substring
parsing of the file names (think thats easy) PLUS something like a CASE
statement. I don't see the CASE statement anywhere.
<p>So will i have to use a bunch of cludgy if/then statements, or is there
something more elequent...
<p><tt> if subval > "0001" and subval < "0010" :</tt>
<br><tt> <filecopyingsteps></tt>
<br><tt> elif subval > "0009" and subval < "0020" :</tt>
<br><tt> <filecopyingsteps></tt>
<br><tt>........</tt>
<p>Thanks
<br>(python 2.2.1 is installed...whoo hoo!)
<p>rich pinder
<br>usc school of medicine</html>
--------------8F9C34CC7747D2EB44498E3A--