View Full Version : Folder lists (W98)
Wolfy669
05-22-2002, 02:47 AM
I am running win98SE. I have alot of files in one of my folders and i would like to document the files so i have a list of what files i have in the folder so i can back them up. I have asked and people say i cannot do it. I believe you can but i do not know how. Any other programs would help.
Simon Woulfe
jdharm
05-22-2002, 07:01 AM
This thread[/b]</font color=blue> (http://www.winguides.com/forums/showflat.php?Cat=&Board=brdQuestions&Number=36812&page=&view=&sb=&vc=1>[b]<font) describes how to output the directory of a folder to a printer or to a text file.
Josh
"What we call 'Progress' is the exchange of one nuisance for another nuisance."
Picapica
05-22-2002, 10:05 AM
And here is a freeware app, easy UI and all:
http://www.karenware.com/powertools/powertools.asp
Look for 'Directory Printer'.
-----------------------------------------------
desde hoy en adelante: la buena vida
I've created a script that logs to a text file the files and folders in a given folder.
It even goes through all subfolder and documents them too.
The script can include a great deal of information about the folder, its subfolders and files. You choose how much of this info is written to the log file.
To include an optional piece of info, just remove those two characters ( <font color=red>'< </font color=red>) from the beginning of the line that has the info you want to include.
Example, to include the file's date created property in your log, change this line;
<font color=red>'< </font color=red> fReport.Writeline "Date Created: " & File.DateCreated
to;
fReport.Writeline "Date Created: " & File.DateCreated
'%%%%%%%%%%%%%%%%%%% FolderReport.vbs %%%%%%%%%%%%%%%%%%
'************************************************* ******
'************************************************* ******
'Name and location of the log file. If the file already
'exists, it will be overwritten!
sReportName = "C:\New Folder\FolderFiles-LogFile.txt"
'Apart from this line, you don't have to edit or change
'anything Else!
'************************************************* ******
'************************************************* ******
On Error Resume Next
'Code to Retrieve a Folder's Pathname using the
'system's Browse For Folder dialog box
Const BIF_EDITBOX = &H10
Const BIF_NEWDIALOGSTYLE = &H40
Set sa = CreateObject("Shell.Application")
Set oF = sa.BrowseForFolder(0, "My Computer:",_
BIF_EDITBOX Or BIF_NEWDIALOGSTYLE)
Set fi = oF.Items.Item
'************************************************* ****
'************************************************* ****
StartPath = fi.Path
'************************************************* ****
'************************************************* ****
If Err.Number > 0 Then
MsgBox("You have not selected a folder." & vbCrlf &_
"This script will not continue!")
Err.Clear
WScript.Quit 1
End If
Set oFSo = CreateObject("Scripting.FileSystemObject")
Set fReport = oFSo.CreateTextFile(sReportName, True)
ListFolders(StartPath)
Sub ListFolders(SPath)
Set oFolder = oFSO.GetFolder(sPath)
fReport.Writeline oFolder
fReport.Writeline "Folder size: " & _
Round(oFolder.Size / 1048576, 2) & "MB"
fReport.Writeline "SubFolders Count: " & oFolder.SubFolders.Count
fReport.Writeline "File count: " & oFolder.Files.Count
<font color=blue>'&&&&&&&&&&&&&&& Optional Folder Attributes &&&&&&&&&&&&&&&&&&&&
'To include these in your report, remove both the "'<" Characters
'at the start of each line in this section that you wont to use.
'&&&&&&&&&&&&&&&&&&&&&&&&& Optional &&&&&&&&&&&&&&&&&&&&&&&&&&&&&
'< fReport.Writeline "Base name: " & oFolder.Name
'< fReport.Writeline "Folder Attributes: " & oFolder.Attributes
'< fReport.Writeline "Date Created: " & oFolder.DateCreated
'< fReport.Writeline "Date Last Accessed: " & oFolder.DateLastAccessed
'< fReport.Writeline "Date Last Modified: " & oFolder.DateLastModified
'< fReport.Writeline "Short Name: " & oFolder.ShortName
'< fReport.Writeline "Short Path: " & oFolder.ShortPath
'< fReport.Writeline "Folder Type: " & oFolder.Type
'&&&&&&&&&&&&&&&&&&&&&&&& End Optional &&&&&&&&&&&&&&&&&&&&&&&&&&&&</font color=blue>
fReport.WriteBlankLines(1)
Set FldrFiles = oFolder.Files
fReport.Writeline FldrFiles.Count & " " & "File(s) In this folder;"
fReport.Writeline "****************************"
for each file in FldrFiles
fReport.Writeline File.Name & " " & " " &_
Round(File.Size / 1048576, 3) & "MB"
<font color=blue>'&&&&&&&&&&&&&&&&& Optional File attributes &&&&&&&&&&&&&&&&&&&&&
'To include these in your report, remove both the "'<" Characters
'at the start of each line in this section that you wont to use.
'&&&&&&&&&&&&&&&&&&&&& Optional &&&&&&&&&&&&&&&&&&&&&&&&&&&&&
'< fReport.Writeline "Date Created: " & File.DateCreated
'< fReport.Writeline "Date Last Accessed: " & File.DateLastAccessed
'< fReport.Writeline "Date Last Modified: " & File.DateLastModified
'< fReport.Writeline "Short Name: " & File.ShortName
'< fReport.Writeline "Short Path: " & File.ShortPath
'< fReport.Writeline "Type Property: " & File.TypeProperty
'&&&&&&&&&&&&&&&&&&&&&&&& End Optional &&&&&&&&&&&&&&&&&&&&&&&&&&&</font color=blue>
Next
fReport.Writeline "=============================================" &_
"=================================="
fReport.WriteBlankLines(1)
For Each oFldr In oFolder.SubFolders
ListFolders oFldr.Path
Next
End Sub
fReport.Close
Set sa = Nothing
Set oF = Nothing
Set fi = Nothing
Set oFSo = Nothing
Set fReport = Nothing
Set oFolder = Nothing
Set FldrFiles = Nothing
'%%%%%%%%%%%%%%% Script END %%%%%%%%%%%%%%%%%%
Jama
Picapica
05-22-2002, 04:21 PM
Jama, When I run your script Norton Antivirus kicks in :D
Other than that, it works perfectly; nice work!
Cheers
-----------------------------------------------
desde hoy en adelante: la buena vida
Andy-S
05-22-2002, 04:35 PM
Jama,
Excellent script. I didn't realize how powerful scripting was. I may need to look at learning some of the basics.
Cheers
Andy
mnovak5
05-25-2002, 10:19 AM
For Czech or Slovak users see also
http://www.volny.cz/mnovak55/Filelist/filelist.html
English version will be available "in a finite time".
Michael
Don't ask "Whether..." , ask "How...?"
Powered by vBulletin™ Version 4.1.0 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.