Devo rinominare dei file chiamati "news10.txt", "news11.txt" ecc. in modo che il numero associato sia MAGGIORE di uno. Cioè :
"news5.txt" deve diventare "news6.txt"
"news4.txt" deve diventare "news5.txt"
"news3.txt" deve diventare "news4.txt"
ecc. ecc.
Da notare che i file potrebbero anche non esserci.
Ordunque, ho provato con il seguente codice ma mi fa rinominare solo l'ultimo file. Gli altri non vengono rinominati.. Come mai??![]()
FOR xxx = totale TO 1 STEP -1
StrFile = Server.MapPath("news"&CInt(xxx)&".txt")
StrFile2 = Server.MapPath("news"&CInt(xxx)+1&".txt")
Set fso = CreateObject("Scripting.FileSystemObject")
IF (fso.FileExists(StrFile))=true THEN
fso.MoveFile StrFile, StrFile2
END IF
NEXT
Set fso = Nothing