ajtsystems
IS-IT--Management
Hi,
I have a path which I need to trim down so that I have the last folder of it. The string I have is
c:\windows\system32\copyfolder.
I need to use \copyfolder as a variable elsewhere. I have looked at various functions but can seem to find anything which wors including Right, Left and Trim. I guess from the right to the first "\" and set as a variable. Here is my code so far:
sub DeleteWebConfigb4Copy (backupdir, arrmem)
arrmem
path = backupdir & "\" & "scripts"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(path)
Set colFiles = objFolder.Files
For Each objFile in colFiles
if instr (objfile,"web.config") then
objfile.delete
wscript.echo "gone"
end if
next
end sub
Backupdir when passed to the Sub is "c:\copy and arrmem is c:\windows\system32\copyfolder and its arrmem which needs to be chopped up and added to backupdir.
Would I use Instr ?
Thanks
I have a path which I need to trim down so that I have the last folder of it. The string I have is
c:\windows\system32\copyfolder.
I need to use \copyfolder as a variable elsewhere. I have looked at various functions but can seem to find anything which wors including Right, Left and Trim. I guess from the right to the first "\" and set as a variable. Here is my code so far:
sub DeleteWebConfigb4Copy (backupdir, arrmem)
arrmem
path = backupdir & "\" & "scripts"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(path)
Set colFiles = objFolder.Files
For Each objFile in colFiles
if instr (objfile,"web.config") then
objfile.delete
wscript.echo "gone"
end if
next
end sub
Backupdir when passed to the Sub is "c:\copy and arrmem is c:\windows\system32\copyfolder and its arrmem which needs to be chopped up and added to backupdir.
Would I use Instr ?
Thanks