|
|
![]() |
|
|
Top | #1 |
|
Blame me for the RAZR's
Joined: March 2004
Location: Houston, Texas
Posts: 3,631
Reputation: 1240
Power: 122 |
I need a program that generates a text file on all the file names and meta data of the text file in a folder. In essence i just want to take everything in folder detail view and put it into a text file. any ideas anyone?
-Sean |
|
|
|
|
|
|
|
|
Top | #2 |
|
There is no answer!
Joined: October 2004
Location: FL, USA
Posts: 3,088
Blog Entries: 3
Reputation: 1430
Power: 111 |
open up a command prompt go to the root folder containing the info you need in a text folder and type this into the cmd line
dir /b/p > text.txt (change the text name to whatever you want, hope this is what you mean. |
|
|
|
|
|
|
|
|
Top | #3 |
|
There is no answer!
Joined: October 2004
Location: FL, USA
Posts: 3,088
Blog Entries: 3
Reputation: 1430
Power: 111 |
that only shows the folders and files within the root folder that you are in, but does not expose the files within the file tree, perhaps there is a program for that.
|
|
|
|
|
|
|
|
|
Top | #4 |
|
Marathon Project
Joined: January 2004
Location: Isle of Man
Posts: 55
Reputation: 90
Power: 76 |
|
|
|
|
|
|
Top | #5 |
|
Blame me for the RAZR's
Joined: March 2004
Location: Houston, Texas
Posts: 3,631
Reputation: 1240
Power: 122 |
Ok that worked ok but is there any way i can get the date modified in the txt file as well. thats a important part.
|
|
|
|
|
|
|
|
|
Top | #6 |
|
There is no answer!
Joined: October 2004
Location: FL, USA
Posts: 3,088
Blog Entries: 3
Reputation: 1430
Power: 111 |
how do you mean date modified?
|
|
|
|
|
|
|
|
|
Top | #7 |
|
Blame me for the RAZR's
Joined: March 2004
Location: Houston, Texas
Posts: 3,631
Reputation: 1240
Power: 122 |
Go to a folder. click on view and detail
Over to the right side it will say what date the file was last modified on. I assume thats meta data for the file. |
|
|
|
|
|
|
|
|
Top | #8 |
|
There is no answer!
Joined: October 2004
Location: FL, USA
Posts: 3,088
Blog Entries: 3
Reputation: 1430
Power: 111 |
well if you did this:
dir /a:d > text.txt it'll give you that info. |
|
|
|
|
|
|
|
|
Top | #9 |
|
XPista7eopard*ix
Joined: April 2004
Location: Chicagoland
Posts: 3,916
Reputation: 2599
Power: 136 |
umm.. dir /a:d will only display the directories.. not the files
"dir /tw /s > list.txt" will list the "time last written" field as well as all the files in sub directories edit: doing a dir /a /tw /s will include hidden/system files in that list... edit: if you want something a lot more fancier.. you would probably have to look into some WSH scripting (hint: google VBScript and File System Object if you want to go down that road.) |
|
|
|
|
|
|
|
|
Top | #10 |
|
XPista7eopard*ix
Joined: April 2004
Location: Chicagoland
Posts: 3,916
Reputation: 2599
Power: 136 |
for those that care.. the help file on the dir command is fairly helpful
dir /? Code:
Displays a list of files and subdirectories in a directory.
DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
[/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]
[drive:][path][filename]
Specifies drive, directory, and/or files to list.
/A Displays files with specified attributes.
attributes D Directories R Read-only files
H Hidden files A Files ready for archiving
S System files - Prefix meaning not
/B Uses bare format (no heading information or summary).
/C Display the thousand separator in file sizes. This is the
default. Use /-C to disable display of separator.
/D Same as wide but files are list sorted by column.
/L Uses lowercase.
/N New long list format where filenames are on the far right.
/O List by files in sorted order.
sortorder N By name (alphabetic) S By size (smallest first)
E By extension (alphabetic) D By date/time (oldest first)
G Group directories first - Prefix to reverse order
/P Pauses after each screenful of information.
/Q Display the owner of the file.
/S Displays files in specified directory and all subdirectories.
/T Controls which time field displayed or used for sorting
timefield C Creation
A Last Access
W Last Written
/W Uses wide list format.
/X This displays the short names generated for non-8dot3 file
names. The format is that of /N with the short name inserted
before the long name. If no short name is present, blanks are
displayed in its place.
/4 Displays four-digit years
Switches may be preset in the DIRCMD environment variable. Override
preset switches by prefixing any switch with - (hyphen)--for example, /-W.
|
|
|
|
|
|
|
|
|
Top | #11 |
|
Blame me for the RAZR's
Joined: March 2004
Location: Houston, Texas
Posts: 3,631
Reputation: 1240
Power: 122 |
thanks fitz. i got it going then i am able to use import in excel to tweak the data. repps too who i can give them too.
|
|
|
|
|
|
|
|
|
Top | #12 |
|
OSNN Veteran Addict
Joined: January 2002
Location: Brossard,Quebec
Posts: 4,721
Blog Entries: 1
Reputation: 1481
Power: 161 |
'---------------------------------------------------------
'Written by Vic Laurie, January, 2006 'All rights reserved. Provided as is 'with no guarantees, express or implied 'User assumes all responsibility '--------------------------------------------------------- 'Description- Lists all files in a selected folder and its subfolders 'that are of a given type selected by user. 'Uses Dir with switches Option Explicit Dim sFldrInput1, sFldrInput2, sExtension, introMsg, sSwitches introMsg = msgBox ("This program creates a list of all files of a given type"& vbCrLf & "that are in a selected folder and optionally its subfolders." & vbCrLf & "If there are many files, it may take a few minutes."& vbCrLf & "A message will appear when the list is finished.",vbOKCancel) If introMsg = vbCancel Then Wscript.Quit End If ChooseFolder sFldrInput1,"Select the folder containing files to be listed" ChooseFolder sFldrInput2, "Select the folder where list is to be put" ChooseExtension sExtension ChooseSubfldr sSwitches MakeList sFldrInput1, sFldrInput2, sExtension Wscript.Quit sub ChooseFolder(sFldrChoice, sSelectionString) dim objShell, objFolder, objFolderItem, strPath, msgValue Const DESK_TOP = &H10& Const WINDOW_HANDLE = 0 Const OPTIONS = 0 sFldrChoice = "" Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.Namespace(DESK_TOP) Set objFolderItem = objFolder.Self strPath = objFolderItem.Path Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.BrowseForFolder _ (WINDOW_HANDLE, sSelectionString, OPTIONS, strPath) If objFolder Is Nothing Then Wscript.Quit End If Set objFolderItem = objFolder.Self sFldrChoice = objFolderItem.Path msgValue = msgBox("You selected "& sFldrChoice, vbOKCancel) If msgValue = vbCancel Then Wscript.Quit End If If Len(sFldrChoice) = 3 then chkForDrv sFldrChoice End if End sub Sub ChooseExtension(sExtension) sExtension = InputBox("Enter extension of files to be listed.", "Name of extension") If sExtension = "" Then Wscript.Quit End If chkForDot sExtension End sub Sub MakeList(sourceFldr, listFldr, Extension) Const sdirCmd ="cmd /c dir " Const sWildCard = "\*." Const sRedirect =">" dim listFile dim sStatement dim objWshell Dim oIE, oIEDoc, sMsg listFile ="\list" & Extension & ".txt" sStatement = sdirCmd & chr(34) & sourceFldr & sWildcard & Extension & chr(34) & sSwitches & sRedirect & chr(34) & listFldr & listFile & chr(34) 'The next part is just to display a message while making list set objWshell=Wscript.CreateObject("Wscript.Shell") Set oIE = Wscript.CreateObject("InternetExplorer.Application") oIE.Navigate "about:blank" do while oIE.busy : wscript.sleep 10 : loop Set oIEDoc = oIE.Document oIE.AddressBar = False oIE.StatusBar = False oIE.ToolBar = False oIE.height=200 oIE.width=300 oIE.Resizable = False oIE.Visible = True sMsg= "<p><center>List is being made.<br>Please wait.<br>Large numbers of files may take several minutes.</center></p>" oIEDoc.Body.Innerhtml= sMsg 'List the files objWshell.Run sStatement,7,true Set oIEDoc = Nothing oIE.Quit Set oIE = Nothing set objWshell = Nothing msgBox "List has been made of " & sExtension & " files" End sub Sub chkForDrv(sFldrChoice) Dim oRe, bMatch set oRe = New RegExp oRe.pattern = "[a-zA-Z]:\\$" bMatch= oRe.Test(sFldrChoice) If bMatch Then sFldrChoice= Left(sFldrChoice, 2) Set oRe = Nothing End sub Sub chkForDot(sExtension) Dim lenExt, truncStr lenExt = Len(sExtension) truncStr =left(sExtension,1) If truncStr = "." then sExtension = right(sExtension,lenExt-1) End if End sub Sub ChooseSubfldr(sSwitches) dim sSubfldrYesNo sSubfldrYesNo = msgBox("Do you want to list files in all subfolders also?", vbYesNoCancel+vbQuestion) Select Case sSubfldrYesNo case vbCancel Wscript.Quit case vbNo sSwitches = " /o:g" case vbYes sSwitches = " /o:g /s" End select end sub ............. Dont not take below the .......... copy and save as .vbs |
|
|
|
|
|
|
|
|
Top | #13 |
|
Blame me for the RAZR's
Joined: March 2004
Location: Houston, Texas
Posts: 3,631
Reputation: 1240
Power: 122 |
That is cool. I may have to modify that some to what i need. I can write in vbs a bit. Lol ironically this is the first batch files i have ever made to do this other stuff though. I decided its good to be well rounded as a lot of patches we push is through cmd.
|
|
|
|
|
|
|
|
|
Top | #14 |
|
XPista7eopard*ix
Joined: April 2004
Location: Chicagoland
Posts: 3,916
Reputation: 2599
Power: 136 |
hmm.. he's doing shell commands in that script. I would prefer to use the File System Object.. you can grab other file info through the file system object that you couldn't get through a dir command (things like file version, etc..). His command also does not list hidden or system folders and/or files (easily fixed by adding the correct switches to his command constant)
Using the FSO would usually require setting up an array of the list of files in a folder and looping through the array to grab the requested info and writing out to a file.. subdirectory recusion with the FSO is a little more difficult, You would probably look at seeting up a recusrive call to a function that performs the lookups. Would probably take a couple hours work (maybe longer if you aren't all that familiar with scripting/programming) to whip up a vbs script and test it. |
|
|
|
|
|
|
|
|
Top | #15 |
|
OSNN Veteran Addict
Joined: January 2002
Location: Brossard,Quebec
Posts: 4,721
Blog Entries: 1
Reputation: 1481
Power: 161 |
Here is one for hidden files if you need it.
................ '--------------------------------------------------------- 'Written by Vic Laurie, January, 2006 'All rights reserved. Provided as is 'with no guarantees, express or implied 'User assumes all responsibility '--------------------------------------------------------- 'Description- Lists all files in a selected folder 'and (optionally its subfolders 'Uses Dir with various switches Option Explicit Dim sFldrInput1, sFldrInput2,introMsg, sSwitches introMsg = msgBox ("This program creates a list of all hidden files that are in" & vbCrLf & "a selected folder and its subfolders (if desired)." & vbCrLf & "If there are many files, it may take a few minutes."& vbCrLf & "A message will appear when the list is finished.",vbOKCancel) If introMsg = vbCancel Then Wscript.Quit End If ChooseFolder sFldrInput1,"Select the folder containing files to be listed" ChooseFolder sFldrInput2, "Select the folder where list is to be put" ChooseSubfldr sSwitches MakeList sFldrInput1, sFldrInput2, sSwitches Wscript.Quit sub ChooseFolder(sFldrChoice, sSelectionString) dim objShell, objFolder, objFolderItem, strPath, msgValue Const DESK_TOP = &H10& Const WINDOW_HANDLE = 0 Const OPTIONS = 0 sFldrChoice = "" Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.Namespace(DESK_TOP) Set objFolderItem = objFolder.Self strPath = objFolderItem.Path Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.BrowseForFolder _ (WINDOW_HANDLE, sSelectionString, OPTIONS, strPath) If objFolder Is Nothing Then Wscript.Quit End If Set objFolderItem = objFolder.Self sFldrChoice = objFolderItem.Path msgValue = msgBox("You selected "& sFldrChoice, vbOKCancel) If msgValue = vbCancel Then Wscript.Quit End If If Len(sFldrChoice) = 3 then chkForDrv sFldrChoice End if End sub Sub ChooseSubfldr(sSwitches) dim sSubfldrYesNo sSubfldrYesNo = msgBox("Do you want to list files in all subfolders also?", vbYesNoCancel) Select Case sSubfldrYesNo case vbCancel Wscript.Quit case vbNo sSwitches = " /A:H" case vbYes sSwitches = " /A:H /s" End select End sub Sub MakeList(sourceFldr, listFldr, sSwitches) Const sdirCmd ="cmd /c dir " Const sWildCard = "\*.*" Const sRedirect =">" dim listFile dim sStatement dim objWshell Dim oIE, oIEDoc, sMsg listFile ="\list_of_hidden_files.txt" sStatement = sdirCmd & chr(34) & sourceFldr & sWildcard & chr(34) & sSWitches & sRedirect & chr(34) & listFldr & listFile & chr(34) 'The next part is just to display a message while making list set objWshell=Wscript.CreateObject("Wscript.Shell") Set oIE = Wscript.CreateObject("InternetExplorer.Application") oIE.Navigate "about:blank" do while oIE.busy : wscript.sleep 10 : loop Set oIEDoc = oIE.Document oIE.AddressBar = False oIE.StatusBar = False oIE.ToolBar = False oIE.height=200 oIE.width=300 oIE.Resizable = False oIE.Visible = True sMsg= "<p><center>List is being made.<br>Please wait.<br>Large numbers of files may take several minutes.</center></p>" oIEDoc.Body.Innerhtml= sMsg 'List the files objWshell.Run sStatement,7,true Set oIEDoc = Nothing oIE.Quit Set oIE = Nothing set objWshell = Nothing msgBox "List has been made of hidden files" End sub Sub chkForDrv(sFldrChoice) Dim oRe, bMatch set oRe = New RegExp oRe.pattern = "[a-zA-Z]:\\$" bMatch= oRe.Test(sFldrChoice) If bMatch Then sFldrChoice= Left(sFldrChoice, 2) Set oRe = Nothing End sub .............. |
|
|
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| outlook - not importing ALL names from Excel file | greggustin | Windows Applications | 1 | March 29th, 2008 3:01am |
| Text file merge util | 762x51 | Windows Desktop Systems | 3 | June 27th, 2006 7:21am |
| how to recover adr + mail file/data | Mabuse | Windows Desktop Systems | 2 | January 2nd, 2003 11:52am |
| XP Forgets Folder settings and reverses file names | wavekite | Windows Desktop Systems | 3 | February 14th, 2002 9:01pm |
| file names blue in explorer | cam | Windows Desktop Systems | 5 | December 20th, 2001 5:15pm |
![]() |