On Sat 09 Feb 2008 09:20:12 NZDT +1300, Roger Searle wrote: > What I would really like to do is be retaining each of the previous copies > of the newsite-old folder, and having the script append an increasing > number to the folder name each time it ran, ie newsite-old1 then > newsite-old2 etc. > How could I modify the mv command so that it did this for me?
The mv command won't do it for you. You'll need to write a script. 2 Approaches are possible. 1) Generate the numbers, increasing, use the first which doesn't already exist. Doesn't scale well for large numbers of existing numbers. 2) Make assumptions on what is in the directory, and use a suitable "ls -1 PREFIX-*" to generate a list of what's there. Sort that list to find out the last used number. Tip: use fixed-width numbers. Scales much better. Or you could so something altogether different and rename the entry to a name which contains a date and time stamp. If you use a time stamp including seconds the method will always work unless you rename more often than once in the same second. Volker -- Volker Kuhlmann is list0570 with the domain in header http://volker.dnsalias.net/ Please do not CC list postings to me.
