This is a discussion on Re: Renaming files by counting the number of files within the Sco Unix forums, part of the Unix Operating Systems category; --> scooter6 wrote: > SCO OpenServer 5.0.5 all patches, etc.... > > > I have a process that I need ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 Scott, If 253 is a Julian date, you're even older than me! By julian, you mean date +%j correct? the number of today in the current year. If yes, then why not simply make that directory more specific by adding the time of day? ie, instead of date +%j use date +%j%k%M which will include hours and minutes, and be sortable. Format it differently to make it more readable. Then you don't have to do any pushing and shoving to get things into unique directories. Best of luck, Dan Martin Team 1 > > once my program runs, there will be files there as such: > > 09090401.tar > 09090402.tar > 09090403.tar > > as you can see these are in mmddyy[01-99].tar format....depending on > how many records it finds, it can make only 1 tar file or at the max > it will make 10 of them.... > > 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 > > What I'd like to do now, before the process runs again in about 4 > hours (or whenever I tell it to via cron) is move the files to a > nested directory under here.... > i.e. I want to create > > /u/home/data/bcu253/bcu253a and move the tar files into that directory > so I would have this: > > doing an 'l' in this directory /u/home/data/bcu/253 > > you should now only see the directory > > drwxr-xr-x 2 root sys 512 Sep 9 15:58 bcu253a > > and in that directory (bcu253a) would be the tar files I just put > there... > > Now, the next time I run this process, I want to somehow look up the > number of tar files that sit nested in the bcu253a directory...... > > i.e. if the first time I run the program, it creates 5 tar files, > 09090401.tar thru 09090405.tar > > the second time it runs, it will create tar files again, just in the > /u/home/data/bcu253 directory and it will name them the same.... > 09090401.tar > 09090402.tar etc > > okay..now based on how many tar files it created the first time (in my > example it created 5), I want to move the 'new' 09090401.tar file to > 09090406.tar > and move 09090402.tar to 09090407.tar , etc, etc.... > > Then I want to move those files to /u/home/data/bcu253/bcu253a > directory > and repeat as many times as I want during this day (julian date 253) > The next day, it will start all over again, but bcu254 instead, etc > > Hope this explains clearly what I want to do..... > > Can anyone give me a sample to accomplish this? Really in a crunch > here... > > Thanks > > Scott Ullmann > Telespectrum > sullmann@telespectrum.com |