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: Tue, 15 Aug 2006 22:16:54 +0100

On Tuesday, August 15, 2006, John Posada wrote;

> yeah, I have software that already does that. However, two reasons
> that wouldn't work here...1) it has to be something that each of the
> 10 writers already have and 2) it gets compared to a CD that we don't
> get early enough to be of use. The file list is from a set of
> directories where we drop our final files. The file list is then used
> by Release Engineering as soon as the gold CD is cut to verify that
> the build process went out and got the files. By the time we get the
> CD, it's too late.
---

OK, I assume that they all have Windows Scripting Host (wsh), which
would cover point 1. I note from an earlier post that you need to
specify the directory to be tree-walked and the dump file - so I've
made a couple of mods to allow you to pass these via the command line.
Here's the result:

------------8<----------------------------
Const ROOTFOLDER = "C:\"
Const LISTFILE = "C:\listfile.txt"
Const INCLUDEPATH = True


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

Dim objSubFolder
If Not bFound Then
For Each objSubFolder In objFolder.SubFolders
ParseFolder objSubFolder, iLevel + 1
Next
End If

End Sub

'-----------------[ MAIN ]---------------------
Dim fso, objSubFolders, objFolder, fTarget, strTarget, strRootFolder
If WScript.Arguments.Named.Exists("dir") Then
strRootFolder = WScript.Arguments.Named("dir")
Else
strRootFolder = ROOTFOLDER
End If
If WScript.Arguments.Named.Exists("listfile") Then
strTarget = WScript.Arguments.Named("listfile")
Else
strTarget = LISTFILE
End If
Set fso = CreateObject("Scripting.FileSystemObject")
Set fTarget = fso.OpenTextFile(strTarget, 2, True)
Set objFolder = fso.GetFolder(strRootFolder)
ParseFolder objFolder, 0
fTarget.Close
Set fTarget = Nothing
Set objFolder = Nothing
Set fso = Nothing

------------8<----------------------------

Again, save everything between the cut marks as (say) listfiles.vbs
and then call with:

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

Where <dir to walk> is the directory you want to scan, and
<dump file> is the tab-delimited file for the result. The script
should create this file if it doesn't exist and Excel should readily
import it if you give it a .txt extension.

HTH,

--
Geoff

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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! http://www.webworks.com/techwr-l

Easily create HTML or Microsoft Word content and convert to any popular Help file format or printed documentation. Learn more at http://www.DocToHelp.com/TechwrlList

---
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 http://lists.techwr-l.com/mailman/options/techwr-l/archive%40infoinfocus.com


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
http://www.techwr-l.com/techwhirl/ for more resources and info.


Follow-Ups:

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

Previous by Author: Re: Looking for a dos command
Next by Author: Re: Looking for a dos command
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