Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi ,
I am getting error while compling the vb script
Error: Expected'Then'
Code : 800A03F9while running follwoing vb script for renaming a file.
DIM sourcepath
sourcepath="D:\NEW" 'The path to the source file, includes backslash
DIM sourcefile
sourcefile="server.log" 'The name of the source file without a loop number
DIM destpath
destpath="D:\NEW" 'The path to the destination file, includes backslash
DIM max
max=1000 'The maximum number of copies to keep
DIM a
a=0 'A loop counter
'**** Main Loop ****
FOR a = max-1 TO 1 'Create a decreasing loop counter
IF EXIST destpath &sourcefile &a THEN 'If the filename with current counter's value exists.....COPY (sourcepath & sourcefile, destpath & sourcefile & a+1) 'Copy the file adding the loop counter + 1
END NEXT 'Break out of the FOR-NEXT loop now
END IF
NEXT a 'Otherwise, decrement the loop counter by one and try again.
If someone can help ,Thanks in Advance

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |