It's no perl but it could work : )
make sure you start in the directory with the .doc files

ls -1 *.doc | awk -F. '{printf("cp %s.doc /my/newpath/%s.data\n",$1,$1)}'|
/bin/ksh



                                                                                       
                                                           
                    Simopoulos                                                         
                                                           
                    <[EMAIL PROTECTED]        To:     [EMAIL PROTECTED]             
                                                           
                    fb.af.mil>                  cc:                                    
                                                           
                                                Subject:     Newbie Stupid Question!   
                                                           
                    07/15/2002 01:18 PM                                                
                                                           
                                                                                       
                                                           
                                                                                       
                                                           




Hi All,
I'm a newbie just starting out learning Perl.
My problem is I have a bunch of files that are (.doc) files, and I want to
rename
the files (.data).
I also want move then to another directory, but I don't really want to
destroy or
change the old ones (.doc).
What I've done so far doesn't work the way I want it to.  It is:

#! /usr/bin/perl -w
opendir(DOCUMENTS,".") || die "Can't open directory documents!";
@filenames = readdir(DOCUMENTS);
closedir(DOCUMENTS);
foreach $filename(@filenames) {
   if ($filename =~ m/\.doc$/i) {
       rename($filename, "/home/marsie/data/$filename.dat") ||
                          die "Can't move files";
   } else {
       print "Not a .doc file!\n";
   }
}

I would appreciate any help anyone can offer.
Peace,
Marsie

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


------------------------------------------------------------------------
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to