Hi, I have a script that does a wget on a website, which is working well. Before the wget command I am moving the folder that already exists:

mv $HOME/documents/newsite $HOME/documents/newsite-old

which is fine. So long as the folder newsite-old doesn't already exist because the script had previously been run and the folder exists. If it does, I'd get the following:

mv: cannot move `/home/roger/documents/newsite/' to a subdirectory of itself, `/home/roger/documents/newsite-old/newsite'

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?
Hoping this makes sense,
Roger

Reply via email to