vbscript - VBS passing variable to recursive sub -


i relative newbie vbs , scripting in general. i've got housekeeping script among other things clears empty folders i've got bit of trouble with, can tell me going wrong..

here sub

sub clearfolder(folder) 'recursive search old empty folders each subfolder in folder.subfolders     if subfolder.files.count = 0 , subfolder.subfolders.count = 0         logwrite "the folder:" & subfolder.path & " empty , removed"         redim preserve arrfolders(arrpath)         arrfolders(arrpath) = subfolder.path         foldersdeleted = foldersdeleted + 1         arrpath = arrpath + 1     else         logwrite "the folder:" & subfolder.path & " contains files or folders"     end if     clearfolder subfolder next end sub 

when call sub..

this works:

clearfolder objfso.getfolder ("f:\scripts\file_cleardown\testing\_uk") 

this doesn't work: (strvariable above path)

clearfolder objfso.getfolder (strvariable) 

could explain why can't seem pass variable contains path instead of full path? i've tried various ways pass path variable below error.

--------------------------- windows script host --------------------------- script: f:\scripts\file_cleardown\bill_cleanup.vbs line:   70 char:   2 error:  object required: 'folder' code:   800a01a8 source: microsoft vbscript runtime error  --------------------------- ok    --------------------------- 

thanks in advance!


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -