Copy File Lists from Windows Explorer

G

Guest

We would like to copy file lists from Windows Explorer into Word or Excel as
text .

Does anyone know how to do this please
 
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"
 
D

David Candy

Is there a reason you keep answering already answered questions with inferior answers.
 
K

Ken Blake, MVP

Steve126 said:
We would like to copy file lists from Windows Explorer into Word or
Excel as text .

Does anyone know how to do this please


Instead of using Explorer, go to a command prompt and issue the command

dir folderpath >filename.txt (substitute the appropraite path for the folder
you want).

Then open filename.txt in Word or Excel.
 
D

Don Taylor

=?Utf-8?B?U3RldmUxMjY=?= said:
We would like to copy file lists from Windows Explorer into Word or Excel as
text .
Does anyone know how to do this please

Hop into Excel, you are going to create a simple macro to do this.
Go into Tools->Macro->Macros and give it a name MyDir and click Create.
That should drop you onto a new screen with

Sub MyDir()
End Sub

Replace all of those two lines with this:

Function MyDir(VIn1 As Variant) As Variant
Dim vaResult(20) As Variant
Dim i
i = 0
vaResult(i) = Dir(VIn1) ' Retrieve the first entry.
Do While vaResult(i) <> ""
i = i + 1
vaResult(i) = Dir ' Retrieve the next entries.
Loop
MyDir = vaResult
End Function

Now click File->Close and return to Excel
and you will be put back in your spreadsheet.

Now select twenty cells in a horizontal row of cells,
by depressing the left mouse button in the left most cell
and dragging horizontally across the twenty cells.
Release mouse button and then type

=MyDir("C:\*.*")<ctrl><shift><enter>

where <ctrl> is the Ctrl key pressed first and held down
and then <shift> is pressed next and held down
and finally <enter> is pressed. Then release all three keys.

If the magic worked then your row of cells will be
filled with the directory contents of C:\*.*.

Test this cautiously on sheets that don't have data
that you cannot afford to loose. Test it several
different times, make sure it works for you as you expect.
 
B

Bruce Chambers

Steve126 said:
We would like to copy file lists from Windows Explorer into Word or Excel as
text .

Does anyone know how to do this please


From the command prompt (Start > Run > Cmd.exe), simply change to
the desired directory and type "dir > filelist.txt" or "dir > lpt1,"
just as you used to do in DOS. Any of the switches for the DIR command
(type "dir /?") will work with this command, if you wish to modify the
output. You can then subsequently edit the resulting text file using
NotePad, WordPad, Word, etc.

Alternatively:

HOW TO Add a Print Directory Feature for Folders in Windows XP
http://support.microsoft.com/?kbid=321379


--

Bruce Chambers

Help us help you:



They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety. -Benjamin Franklin

Is life so dear or peace so sweet as to be purchased at the price of
chains and slavery? .... I know not what course others may take, but as
for me, give me liberty, or give me death! -Patrick Henry
 

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