View Single Post

   
  #2 (permalink)  
Old 02-15-2008, 04:07 PM
scooter6
 
Posts: n/a
Default Re: Renaming files by counting the number of files

"Tony Lawrence" <pcunix@gmail.com> wrote in message news:<chqggt$s89@odbk17.prod.google.com>...
> scooter6 wrote:
> > SCO OpenServer 5.0.5 all patches, etc....
> >
> >
> > I have a process that I need to run more than once a day (as it was
> > originally designed)
> >
> > This process creates a directory with the julian date in it...
> >
> > i.e. /u/home/data/bcu253
> >
> > once my program runs, there will be files there as such:
> >
> > 09090401.tar
> > 09090402.tar
> > 09090403.tar

>
> ..
>
> > So, at this point I have this directory:
> >
> > /u/home/data/bcu253
> >
> > and I have the files in this directory called:
> >
> > 09090401.tar
> > 09090402.tar etc, etc

>
> etc.
>
> Well, I'm not going to write your script for you, but something like.:
>
> XX=`ls bcu253\*.tar|wc -l`
> XX=`echo $XX | sed s/ *//g`
> for i in *tar
> do
>
> XX=`expr $XX + 1`
> j=`echo $i | sed "s/^\(....\)../\1$XX/"`
> cp $i bcu253/$j
>
> done
>
> Easier in bash or ksh and a whole bunch easier in Perl.


Okay....I can do it in Perl...show me how please? ughhhh

Scot
Reply With Quote