Directory listing to text file?

D

Doug Kanter

I occasionally need to send a dir listing to a text file. It this only
happened often with one directory, I'd edit the path so it would work from
the command line. But, it's different each time, so this is a pain to do. Is
anyone aware of a utility that somehow gets around this problem?
 
R

rschroe

Doug said:
I occasionally need to send a dir listing to a text file. It this only
happened often with one directory, I'd edit the path so it would work from
the command line. But, it's different each time, so this is a pain to do. Is
anyone aware of a utility that somehow gets around this problem?

Very simple - right click in the cmd window - select all - open notepad
- paste
 
D

Doug Kanter

Very simple - right click in the cmd window - select all - open notepad
- paste

Nice trick, but first you have to navigate to the correct directory. That
involves turning this...
C:\Documents and Settings\Doug\My Documents\My Music

into the version with the tilde symbols, right? If it was always the same
folder, I'd figure out a shortcut. But, it varies a lot.
 
E

Ed Cayce

Doug, maybe I am not understanding your problem... but wouldn't

dir > c:\myfolder\myfile.txt

work?

Ed
 
D

Doug Kanter

Ed Cayce said:
Doug, maybe I am not understanding your problem... but wouldn't

dir > c:\myfolder\myfile.txt

work?

Ed

It would, except that I'm trying to eliminate some of the extra steps.
Example: Let's say I want to use DOS commands to go to this folder:
C:\Documents and Settings\Doug\My Documents\My Music

I can copy the address from Explorer, and paste it into the command line,
but I'm trying to eliminate that step if possible.
 
W

Wesley Vogel

LOL

I like being able to right click a folder and select Print Directory.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
D

Donald Lessau

Doug Kanter said:
Example: Let's say I want to use DOS commands to go to this folder:
C:\Documents and Settings\Doug\My Documents\My Music

I can copy the address from Explorer, and paste it into the command line,
but I'm trying to eliminate that step if possible.

I like being able to right-click a folder and select "Open Command Prompt
Here" in XYplorer. Is that what you are after?
 
D

Doug Kanter

Donald Lessau said:
I like being able to right-click a folder and select "Open Command Prompt
Here" in XYplorer. Is that what you are after?

That would work.
 
D

David Candy

Use Start Run, type

cmd /k cd /d<a space>

Then drag the folder in.



Windows Registry Editor Version 5.00

;----------------------------------
;Binary View
;Uses Edit to give a Binary view of the file
;----------------------------------
[HKEY_CLASSES_ROOT\*\Shell\BinaryView]
@="&Binary View"
"Extended"=""
[HKEY_CLASSES_ROOT\*\Shell\BinaryView\command]
@="Edit.com /78 /r /h %L"

;----------------------------------
;Text View
;Uses Wordpad to edit any text file
;----------------------------------
[HKEY_CLASSES_ROOT\*\Shell\TextView]
@="&Text View"
"Extended"=""
[HKEY_CLASSES_ROOT\*\Shell\TextView\command]
@="wordpad.exe \"%1\""

;----------------------------------
;Print Directory Lists
;----------------------------------
;Prints direct to printer
;----------------------------------
[HKEY_CLASSES_ROOT\Directory\shell\Print]
"Extended"=""
[HKEY_CLASSES_ROOT\Directory\shell\Print\Command]
@="cmd.exe /k dir %L> Prn"

;----------------------------------
;To add a command to the context menu to print a directory listing to a file on the desktop.
;----------------------------------
[HKEY_CLASSES_ROOT\Directory\shell\List]
@="&List"
"Extended"=""
[HKEY_CLASSES_ROOT\Directory\shell\List\command]
@=hex(2):63,00,6d,00,64,00,2e,00,65,00,78,00,65,00,20,00,2f,00,63,00,20,00,64,\
00,69,00,72,00,20,00,22,00,25,00,4c,00,22,00,3e,00,20,00,22,00,25,00,75,00,\
73,00,65,00,72,00,70,00,72,00,6f,00,66,00,69,00,6c,00,65,00,25,00,5c,00,64,\
00,65,00,73,00,6b,00,74,00,6f,00,70,00,5c,00,44,00,69,00,72,00,6c,00,69,00,\
73,00,74,00,2e,00,74,00,78,00,74,00,22,00,00,00

;----------------------------------
;Add Register to OCX
;----------------------------------
[HKEY_CLASSES_ROOT\ocxfile\Shell\Register]
"Extended"=""
[HKEY_CLASSES_ROOT\ocxfile\Shell\Register\command]
@="Regsvr32.exe \"%1\""

;----------------------------------
;Add UnRegister to OCX
;----------------------------------
[HKEY_CLASSES_ROOT\ocxfile\Shell\Unregister]
"Extended"=""
[HKEY_CLASSES_ROOT\ocxfile\Shell\Unregister\command]
@="Regsvr32.exe /u \"%1\""

;----------------------------------
;Add Register to DLL
;----------------------------------
[HKEY_CLASSES_ROOT\dllfile\Shell\Register]
"Extended"=""
[HKEY_CLASSES_ROOT\dllfile\Shell\Register\command]
@="Regsvr32.exe \"%1\""

;----------------------------------
;Add UnRegister to DLL
;----------------------------------
[HKEY_CLASSES_ROOT\dllfile\Shell\Unregister]
"Extended"=""
[HKEY_CLASSES_ROOT\dllfile\Shell\Unregister\command]
@="Regsvr32.exe /u \"%1\""

;----------------------------------
;Add Registers exe files
;----------------------------------
[HKEY_CLASSES_ROOT\exefile\shell\Register]
"Extended"=""
[HKEY_CLASSES_ROOT\exefile\shell\Register\command]
@="\"%1\" /reg"

;----------------------------------
;Add Unregisters exe files
;----------------------------------
[HKEY_CLASSES_ROOT\exefile\shell\Unregister]
"Extended"=""
[HKEY_CLASSES_ROOT\exefile\shell\Unregister\command]
@="\"%1\" /unreg"

;----------------------------------
;Add Install to OCX
;----------------------------------
[HKEY_CLASSES_ROOT\ocxfile\Shell\Install]
"Extended"=""
[HKEY_CLASSES_ROOT\ocxfile\Shell\Install\command]
@="Regsvr32.exe /i \"%1\""

;----------------------------------
;Add Install to DLL
;----------------------------------
[HKEY_CLASSES_ROOT\dllfile\Shell\Install]
"Extended"=""
[HKEY_CLASSES_ROOT\dllfile\Shell\Install\command]
@="Regsvr32.exe /i \"%1\""

;----------------------------------
;Add Command prompt here to Directories
;----------------------------------
[HKEY_CLASSES_ROOT\Directory\shell\DosPrompt]
@="Command Prompt Here"
"Extended"=""
[HKEY_CLASSES_ROOT\Directory\shell\DosPrompt\command]
@="cmd.exe /k cd %L"

;----------------------------------
;Add Command prompt here to Drives
;----------------------------------
[HKEY_CLASSES_ROOT\Drive\shell\DosPrompt]
@="Command Prompt Here"
"Extended"=""
[HKEY_CLASSES_ROOT\Drive\shell\DosPrompt\command]
@="cmd.exe /k cd %L"

;----------------------------------
;Add Explorer rooted at folders
;----------------------------------
[HKEY_CLASSES_ROOT\Folder\shell\rooted]
@="Explorer rooted at"
"Extended"=""
[HKEY_CLASSES_ROOT\Folder\shell\rooted\command]
@="Explorer.exe /e,/root,/idlist,%I"

;----------------------------------
;Add New Explore window
;----------------------------------
[HKEY_CLASSES_ROOT\Folder\shell\new]
@="New Window"
"Extended"=""
[HKEY_CLASSES_ROOT\Folder\shell\new\command]
@="Explorer.exe /n,/idlist,%I"
 
D

David Candy

You can drag a folder from (say explorer) on to the file. You can put it in
Sendto, type sendto in Start Run, copy the file into the sendto folder, then
right click the folder you want to list, Send To, PrintDetailsAppend.
Sending To simulates a drag and drop.

Then import the file into excel, delete the columns you don't want (as most
are blank for any individual type of file, eg MP3 don't have a Date Picture
Taken and JPEGs don't have a Genre property), sort it on description and
delete the files you don't want. That will leave just the properties and
files you want. This is the most general purpose way I can think of to meet
everyones needs.

A drive is the same as a folder for these purposes.

Attached is a VBScript that generate the shell properties (what you see or
could see in Explorer). It is a 51 column csv. There is about 40 properties
on a standard XP and I've allowed about 10 columns for custom properties
that applications may add. Those whove seen it before this one automatically
finds the desktop rather than editing the script. To use, drop a folder on
it or place in Sendto and send a folder to it. If using the for command
(below) you must run it once whereever you put it so it can be found.

To do sub folders type in a command prompt in the folder that you want to
start in (It also does the parent folder - a quirk of For)
for /r %A in (.) do start "" /w "PrintDetailsAppend" "%~dpA"

It creates a file on the desktop called Folder Property List.txt


Set objShell = CreateObject("Shell.Application")
Set Ag=Wscript.Arguments
set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Wscript.ScriptName & "\", Chr(34) & Wscript.ScriptFullName & Chr(34)
WshShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Left(Wscript.ScriptName, Len(Wscript.ScriptName)-3) & "exe" & "\", Chr(34) & Wscript.ScriptFullName & Chr(34)

Set Fldr=objShell.NameSpace(Ag(0))

Set FldrItems=Fldr.Items
Set fso = CreateObject("Scripting.FileSystemObject")


Set DeskFldr=objShell.Namespace(16)
FName=fso.buildpath(DeskFldr.self.path, "Folder Property List.txt")


Set ts = fso.OpenTextFile(FName, 8, vbtrue)



For x = 0 to 50
t1 = t1 & Fldr.GetDetailsOf(vbnull, x) & " (Shell)" & vbtab
Next
ts.write FLDR.self.path &vbcrlf
ts.Write T1 & vbcrlf
T1=""


For Each FldrItem in FldrItems
For x = 0 to 50
t1 = t1 & Fldr.GetDetailsOf(FldrItem, x) & vbtab
Next
t1=t1 & vbcrlf
ts.Write T1
T1=""
Next

'msgbox FName & "has a tab delimited list of all properties"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top