And people, this is the kicker. It was previously (well still is till code is proved working) running windows 95 on a p2 300 workstation with a temperamental disk and the first q I was asked was will is will it be more stable and secure. I had to stiffle my snigger ;)<br>
<br><div class="gmail_quote">2008/5/16 Stuart Burns <<a href="mailto:stuart.james.burns@gmail.com">stuart.james.burns@gmail.com</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Lol, The money for the tea and coffee funds, easier to use the blank cheques lying around ;)<br><br>No, the purpose is to act as a (poor) interface between a MUMPS (aka Cache Intersystems) DB and an IBM iSeries.<br><br>The files concern stock that needs to be reserved and passed from the iSeries to the MUMPS system. So basically the iSeries drops a text file at random intervals onto the FTP server and then the FTP server via the batch script translates it into the correct format.<br>

<br>However I have discovered that numbering, as long as it is mmdxxxx where x is unique, is fine. The RS at the beginning has special meaning in as much as it is indicates a certain type of transaction. I therefore got the required level of uniqueness by tacking %N on the end of the date var.<br>

<br>The final code I came up with (yet to be tested) is<br><br>mount //<a href="http://10.0.0.133/mumps" target="_blank">10.0.0.133/mumps</a> /mnt/mumps -o username=xxx,xxx<br>cd /home/myftpusername/<br>DATE=`date +%m%u%N`<br>
mv RS000001.001 RS$DATE.001<br>
cp RS$DATE.001 Reserve/Backup/<br>mv RS$DATE.001 /mnt/mumps/DATA/DATA_OUT/<br>umount /mnt/mumps<br><br>And thanks to everyone who suggested an answer. I will have to take a look at printf - looks a powerful command!<br><br>

<br><br><div class="gmail_quote"><div class="Ih2E3d">2008/5/16 Michael Crilly <<a href="mailto:e-mail@mcrilly.co.uk" target="_blank">e-mail@mcrilly.co.uk</a>>:<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

I agree with simon. Date would be better and it would make<div><div></div><div class="Wj3C7c"><br>
organisation easier. What does this for contain, by the way? What's it<br>
for, out of interest? Is it all the money you're filtering from the<br>
companies tea and coffee funds? :P<br>
<div><br>
On 5/16/08, Simon Willett <<a href="mailto:simonw@gbitsystems.co.uk" target="_blank">simonw@gbitsystems.co.uk</a>> wrote:<br>
> Hi Stuart,<br>
><br>
><br>
><br>
> A hack would be;<br>
><br>
><br>
><br>
> COUNT=`ls RSmmd*001 | wc -w`<br>
><br>
> COUNT=`expr $COUNT + 1`<br>
><br>
> # COUNT now contains the number of files of type RSmmd + 1<br>
><br>
><br>
><br>
> But you should really be using date +%Y%m%d you actually do want to pre-zero<br>
> the day, and you should also include the year, otherwise the process breaks<br>
> come the year end.<br>
><br>
><br>
><br>
><br>
><br>
> Hope this helps,<br>
><br>
> Simon<br>
><br>
>   _____<br>
><br>
> From: <a href="mailto:chester-bounces@mailman.lug.org.uk" target="_blank">chester-bounces@mailman.lug.org.uk</a><br>
> [mailto:<a href="mailto:chester-bounces@mailman.lug.org.uk" target="_blank">chester-bounces@mailman.lug.org.uk</a>] On Behalf Of Stuart Burns<br>
> Sent: 15 May 2008 20:38<br>
> To: chester<br>
> Subject: [Chester LUG] Help with a bash script<br>
><br>
><br>
><br>
> Hi Everyone.<br>
><br>
> I need a little help with a batch file. I have managed a bit of it, but i'm<br>
> a bit lost now.<br>
><br>
> What I need to do is<br>
><br>
</div>> 1.    Looks for file RS000001.001 in folder<br>
> 2.    Rename it RSmmdnnn.001 (mm=month, d= day number {Monday=1},<br>
<div>> nnnn=unique count for the day)<br>
><br>
> Now this file can appear up to several times a day (ie its going to run as a<br>
> cron job every half hour to pick up the files as they are dumped by ftp) I<br>
> can do the basic stuff with the date ie DATE = `date +%m%u` but setting up<br>
> the nnnn bit is where  I am getting lost.<br>
><br>
> Any help appreciated.<br>
><br>
> Stu<br>
><br>
><br>
<br>
</div><div><div></div><div>--<br>
Sent from Google Mail for mobile | <a href="http://mobile.google.com" target="_blank">mobile.google.com</a><br>
<br>
M. T. Crilly<br>
<a href="http://www.mcrilly.co.uk/" target="_blank">http://www.mcrilly.co.uk/</a><br>
<br>
_______________________________________________<br>
Chester mailing list<br>
<a href="mailto:Chester@mailman.lug.org.uk" target="_blank">Chester@mailman.lug.org.uk</a><br>
<a href="https://mailman.lug.org.uk/mailman/listinfo/chester" target="_blank">https://mailman.lug.org.uk/mailman/listinfo/chester</a><br>
</div></div></div></div></blockquote></div><br>
</blockquote></div><br>