Hello. I've been looking online all over for a VBScript to VB.NET converter, but of course, they are incompatible.
Could someone rewrite these three into VB.NET for me, please?
revert_version.vbs
create_backup.vbs
new_revision.vbs
Thanks.
I couldn't attach them, because they were not blocked by the filter.
Could someone rewrite these three into VB.NET for me, please?
revert_version.vbs
Code:
on error resume next
set fso = createobject("scripting.filesystemobject")
set shell = createobject("shell.application")
revision_file = wscript.arguments.item(0)
revision_folder = fso.getparentfoldername(revision_file)
fso.movefile revision_file , left(revision_file,len(revision_file)-8)&".zip"
set zipfile = shell.namespace(left(revision_file,len(revision_file)-8)&".zip")
set srcfolder = shell.namespace(revision_folder)
for each item in srcfolder.items
if (item.type <> "VERSION File") and (item.name <> fso.getfilename(left(revision_file,len(revision_file)-8)&".zip")) then
if item.isfolder then
fso.deletefolder(item.path)
else
fso.deletefile(item.path)
end if
end if
next
for each item in zipfile.items
srcfolder.copyhere item
next
fso.movefile left(revision_file,len(revision_file)-8)&".zip" , revision_fileCode:
on error resume next
set shell = createobject("shell.application")
set fso = createobject("scripting.filesystemobject")
newfilename = "__BACKUP_"&replace(cstr(date),"/","_")&" "&replace(cstr(time),":","_")
set zipfile = fso.createtextfile(wscript.arguments.item(0)&"\"&newfilename&".zip")
zipfile.write("PK" & chr(5) & chr(6) & string(18,chr(0)))
zipfile.close
set zipfile = shell.namespace(wscript.arguments.item(0)&"\"&newfilename&".zip")
set srcfolder = shell.namespace(wscript.arguments.item(0)&"\")
for each item in srcfolder.items
wscript.sleep 500
if (item.type <> "BACKUP File") and (item.name <> (newfilename&".zip")) then
zipfile.copyhere item
end if
next
' the following loop waits until the script has finished adding files to the zip file
set zipfile2 = fso.getfile(wscript.arguments.item(0)&"\"&newfilename&".zip")
do
zipfile2_size = zipfile2.size
wscript.sleep 100
loop while zipfile2.size > zipfile2_size
wscript.sleep 100
fso.movefile wscript.arguments.item(0)&"\"&newfilename&".zip" , wscript.arguments.item(0)&"\"&newfilename&".backup"Code:
on error resume next
set shell = createobject("shell.application")
set fso = createobject("scripting.filesystemobject")
newfilename = "__REVISION_"&replace(cstr(date),"/","_")&" "&replace(cstr(time),":","_")
set zipfile = fso.createtextfile(wscript.arguments.item(0)&"\"&newfilename&".zip")
zipfile.write("PK" & chr(5) & chr(6) & string(18,chr(0)))
zipfile.close
set zipfile = shell.namespace(wscript.arguments.item(0)&"\"&newfilename&".zip")
set srcfolder = shell.namespace(wscript.arguments.item(0)&"\")
set zipfile2 = fso.getfile(wscript.arguments.item(0)&"\"&newfilename&".zip")
wscript.sleep 500
for each item in srcfolder.items
wscript.echo item.name
wscript.sleep 500
if (item.type <> "VERSION File") and (item.type <> "Compressed (zipped) Folder" ) then
zipfile.copyhere item
do
zipfile2_size = zipfile2.size
wscript.sleep 100
loop while zipfile2.size > zipfile2_size
end if
next
' the following loop waits until the script has finished adding files to the zip file
wscript.sleep 100
fso.movefile wscript.arguments.item(0)&"\"&newfilename&".zip" , wscript.arguments.item(0)&"\"&newfilename&".version"I couldn't attach them, because they were not blocked by the filter.