get list of folders from local drive using vbscript -
i want delete documents(.doc) files computer, know how list of sub folders folder, not how list of folders root directory(ex c:)
subfoldersinfolder = folder.subfolder
gives subfolders of folder. supposedly want folders c:,
set coldrives = objfso.drives each objdrive in coldrives objdrive.subfolder //doesn't work next
for each objfolder in objfso.getfolder("c:\").subfolders wscript.echo objfolder.path next ' or... each objfolder in objfso.getdrive("c:").rootfolder.subfolders wscript.echo objfolder.path next
edit: sundar nataraj Сундар has asked go more detail.
this basic for
loop iterates subfolders
collection. subfolders
property available folder
object. can folder
object root in number of ways. here 2 examples:
- use
getfolder()
function retrieve root folder. - use
rootfolder
property ofdrive
object.
i've added wscript.echo
statement in each example demonstrate use of objfolder
variable.
Comments
Post a Comment