Is there a property of the parent folder that will give a number of sub
folder within the parent

i.e

parentfolder
subfolder1
subfolder2
subfolder3

I'm looking for the number of subfolder which in this case is 3. The
directory level dosen't go any deeper

Re: Get the number of subfolders by \

\
Tue Jan 24 08:30:37 CST 2006

> Is there a property of the parent folder that will give a number of sub
> folder within the parent

> i.e

> parentfolder
> subfolder1
> subfolder2
> subfolder3

> I'm looking for the number of subfolder which in this case is 3. The
> directory level dosen't go any deeper

Number=parentfolder.subFolders.count
--
Crash



Re: Get the number of subfolders by y

y
Tue Jan 24 08:32:45 CST 2006

"Jason" <jason@someone.com> wrote in message
news:e63PN9OIGHA.2320@TK2MSFTNGP11.phx.gbl...
> Is there a property of the parent folder that will give a number of sub
> folder within the parent
>
> i.e
>
> parentfolder
> subfolder1
> subfolder2
> subfolder3
>
> I'm looking for the number of subfolder which in this case is 3. The
> directory level dosen't go any deeper
I'm not sure what you want to know.
You can get count of subfolders with subfolders property of
FileSystemObject.
Drag and drop file or folder to this script Icon.

Dim Args, wParentPath
Set Args = wscript.Arguments
With CreateObject("scripting.filesystemobject")
wParentPath = .GetParentFolderName(Args(0))
wscript.echo .GetFolder(wParentPath).SubFolders.Count
End With

Y Sakuda
from JPN


Re: Get the number of subfolders by Jason

Jason
Tue Jan 24 09:28:59 CST 2006

OK

So if I want to get the number of folder within c:\windows this is what I
need?

Set fso = CreateObject("Scripting.FileSystemObject")
Dim target
Set target = "c:\windows"
s = fso.GetParentFolderName(target).subFolders.count
MsgBox s



""Crash" Dummy" <dvader@deathstar.mil> wrote in message
news:%23XWV$KPIGHA.3176@TK2MSFTNGP12.phx.gbl...
>> Is there a property of the parent folder that will give a number of sub
>> folder within the parent
>
>> i.e
>
>> parentfolder
>> subfolder1
>> subfolder2
>> subfolder3
>
>> I'm looking for the number of subfolder which in this case is 3. The
>> directory level dosen't go any deeper
>
> Number=parentfolder.subFolders.count
> --
> Crash
>
>



Re: Get the number of subfolders by y

y
Tue Jan 24 09:32:33 CST 2006

"Jason" <jason@someone.com> wrote in message
news:Ow0LnrPIGHA.3176@TK2MSFTNGP12.phx.gbl...
> OK
>
> So if I want to get the number of folder within c:\windows this is what I
> need?
>
> Set fso = CreateObject("Scripting.FileSystemObject")
> Dim target
> Set target = "c:\windows"
> s = fso.GetParentFolderName(target).subFolders.count
> MsgBox s
>
No.
s=fso.GetFolder(target).subfolders.count
Note: GetParentFolderName get string, not folderobject.
Y Sakuda from JPN


Re: Get the number of subfolders by \

\
Tue Jan 24 10:08:10 CST 2006

> So if I want to get the number of folder within c:\windows this is what I
> need?

> Set fso = CreateObject("Scripting.FileSystemObject")
> Dim target
> Set target = "c:\windows"
> s = fso.GetParentFolderName(target).subFolders.count
> MsgBox s

Sorry. I assumed you already had the folder object, since you were listing
subfolders. Do as y sakuda says, or break it up:

Set fso = CreateObject("Scripting.FileSystemObject")
Dim target
target = "c:\windows"
Set s = fso.GetFolder(target)

MsgBox s.subFolders.count
--
Crash




Re: Get the number of subfolders (Thanks) by Jason

Jason
Wed Jan 25 08:43:39 CST 2006

Thanks for the help guys
"Jason" <jason@someone.com> wrote in message
news:e63PN9OIGHA.2320@TK2MSFTNGP11.phx.gbl...
> Is there a property of the parent folder that will give a number of sub
> folder within the parent
>
> i.e
>
> parentfolder
> subfolder1
> subfolder2
> subfolder3
>
> I'm looking for the number of subfolder which in this case is 3. The
> directory level dosen't go any deeper
>