Solved Scripting Help Please To See If Folder Exists

October 30, 2013 at 07:56:53
Specs: Windows 7
I am a nub when it comes to scripting. I am trying to search a network share that has user directories, and I want to check to see if a folder exists under each user directory and then if it does print the path and size of the foler. If it doesn't exist I would like it to just move on to the next user directory. Would anybody be able to help me with this?


See More: Scripting Help Please To See If Folder Exists

Report •

October 30, 2013 at 18:40:36
✔ Best Answer
Here's a sloppy stab, but ideally it should all be in vbscript (or powershell). this is a hybrid of vbscript called out of a batch core:
::==== begin batchscript
for /f "tokens=*" %%a in (userdirs) do (
if exist D:\xx\yy\%%a (
for /f "tokens=*" %%b in ('CSCRIPT DIRSIZE D:\xx\yy\%%a') do echo %%b
::===== end batch

'====== begin vbscript DIRSIZE
set fso=createobject("scripting.filesystemobject")
set z=fso.getfolder(wscript.arguments(0))
wscript.echo z.path&" "&z.size
'===== end vbscript

I don't know enough to refine this any further (such as source of user-filenames etc)
consider it "not tested".

Report •
Related Solutions

Ask Question