Re: Looking for a dos command

Subject: Re: Looking for a dos command
From: Geoff Lane <geoff -at- gjctech -dot- co -dot- uk>
To: TECHWR-L <techwr-l -at- lists -dot- techwr-l -dot- com>
Date: Wed, 16 Aug 2006 08:26:52 +0100

On Wednesday, August 16, 2006, John Posada wrote;

> Geoff...this was almost perfect and I feel guilty even asking...but,
> can you suppress the directory?

The final version follows. I've cleaned up the script a bit and added
another command-line parameter. As before, call with:

wscript listfiles.vbs /dir:<dir to walk> /listfile:<dump file>

By default, the script suppresses the path to each file. However, you
can now include the paths by passing the parameter /path:yes. That is:

wscript listfiles.vbs /dir:<dir to walk> /listfile:<dump file> /path:yes

Const ROOTFOLDER = "C:\"
Const LISTFILE = "C:\listfile.txt"

Sub ParseFolder(objFolder)
Dim objFile, strPath, strLine
strPath = objFolder.Path
For Each objFile In objFolder.Files
If bPath Then
strLine = strPath & "\"
strLine = ""
End If
strLine = strLine & objFile.Name & Chr(9) & objFile.Size
fTarget.WriteLine strLine

Dim objSubFolder
For Each objSubFolder In objFolder.SubFolders
ParseFolder objSubFolder

End Sub

'-----------------[ MAIN ]---------------------
Dim fso, objSubFolders, objFolder, fTarget
Dim strTarget, strRootFolder, bPath

If WScript.Arguments.Named.Exists("dir") Then
strRootFolder = WScript.Arguments.Named("dir")
strRootFolder = ROOTFOLDER
End If
If WScript.Arguments.Named.Exists("listfile") Then
strTarget = WScript.Arguments.Named("listfile")
strTarget = LISTFILE
End If
If WScript.Arguments.Named.Exists("path") Then
bPath = True
bPath = False
End If

Set fso = CreateObject("Scripting.FileSystemObject")
Set fTarget = fso.OpenTextFile(strTarget, 2, True)
Set objFolder = fso.GetFolder(strRootFolder)
ParseFolder objFolder
Set fTarget = Nothing
Set objFolder = Nothing
Set fso = Nothing




WebWorks ePublisher Pro for Word features support for every major Help
format plus PDF, HTML and more. Flexible, precise, and efficient content
delivery. Try it today!

Easily create HTML or Microsoft Word content and convert to any popular Help file format or printed documentation. Learn more at

You are currently subscribed to TECHWR-L as archive -at- infoinfocus -dot- com -dot-

To unsubscribe send a blank email to
techwr-l-unsubscribe -at- lists -dot- techwr-l -dot- com
or visit

To subscribe, send a blank email to techwr-l-join -at- lists -dot- techwr-l -dot- com

Send administrative questions to lisa -at- techwr-l -dot- com -dot- Visit for more resources and info.

Re: Looking for a dos command: From: John Posada

Previous by Author: Re: Looking for a dos command
Next by Author: Re: browseable vs browsable
Previous by Thread: Re: Looking for a dos command
Next by Thread: Re: Looking for a dos command

What this post helpful? Share it with friends and colleagues:

Sponsored Ads