I got the following dirs in the folder test:VBSTART
Function GetFolderList(folderspec)
Dim fso, f, f1, fc, s, sf
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec)
Set fc = f.SubFolders
For Each f1 in fc
s = s & f1.name & ";"
sf = GetFolderList(folderspec & "\" & f1.name)
if sf "" then
s = s & f1.name & "\" & sf & ";"
end if
Next
If s dd
Month>mm
Year>yyyy
Let>date=%yyyy%%mm%%dd%
//Init
Let>APP_TITLE=Backup By Knoore
Let>msg_finished=The Backup is finished.%CRLF%The program will now be closed.
Let>todisk=F:\
MidStr>WIN_DIR,1,3,fromdisk
//Dirs
Let>fromdir=%fromdisk%Documents and Settings\%USER_NAME%\
Let>todir=%todisk%backups\%date%\
//Setup info
Let>oldpath[1]=%fromdir%Desktop\test\
Let>newpath[1]=%todir%test\
Let>pathamount=1
//Start
Let>pathnr=1
Repeat>pathnr
Let>pathold=oldpath[%pathnr%]
Let>pathnew=newpath[%pathnr%]
IfDirExists>pathold
GoSub>execute
Endif
Let>pathnr=pathnr+1
Until>pathnr>pathamount
MessageModal>%msg_finished%
SRT>execute
//Files in Folder
Let>copytopath=pathnew
Let>copyfrompath=pathold
GoSub>copyfiles
//Files in SubFolders
VBEVAL>GetFolderList("%pathold%"),folderList
Separate>folderList,;,folders
If>folders_count>0
Let>d-cntr=0
Repeat>d-cntr
Let>d-cntr=d-cntr+1
Let>subfolder=folders_%d-cntr%
Let>copyfrompath=%pathold%%subfolder%
Messagemodal>copyfrompath
Let>copytopath=%pathnew%%subfolder%
GoSub>copyfiles
Until>d-cntr,folders_count
Endif
END>execute
SRT>copyfiles
Run>cmd.exe /c mkdir %copytopath%
Run>cmd.exe /c copy %copyfrompath% %copytopath%
END>copyfiles
goto>end
//IfDirExists>%fromdir%Favorites\
// Let>oldpath[1]=%fromdir%Favorites\
// Let>oldpath[2]=%fromdir%My Documents\
// Let>oldpath[3]=%fromdir%Desktop\
// Let>newpath[1]=%todir%Favorites\
// Let>newpath[2]=%todir%My Documents\
// Let>newpath[3]=%todir%Desktop\
//Else
// Let>oldpath[1]=%fromdir%Favorieten\
// Let>oldpath[2]=%fromdir%Mijn Documenten\
// Let>oldpath[3]=%fromdir%Bureaublad\
// Let>newpath[1]=%todir%Favorieten\
// Let>newpath[2]=%todir%Mijn Documenten\
// Let>newpath[3]=%todir%Bureaublad\
//Endif
//Let>outlookbackup=%dir%Local Settings\Application Data\Microsoft\Outlook\Outlook.pst
label>end
test\Copy of New Folder\New Folder\New Folder\New Folder\
test\New Folder\
If i run the script, it works untill here: test\Copy of New Folder\New Folder\
After that the sub dir aint 1. but 2., because of a bug in the vbscript
1. Copy of New Folder\New Folder\New Folder\
2. New Folder\New Folder\
This is a script i found here in the forums. It works perfect for 2 dir deep sub dirs, but if you have more dirs it will malfunction.
Can someone please help me fix the script?