PC Review


Reply
Thread Tools Rate Thread

How can I copy and paste a directory listing into Excel

 
 
=?Utf-8?B?RmVsaXg=?=
Guest
Posts: n/a
 
      21st Oct 2006
I know how to print a “Directory Listing” but instead I would like to copy
and paste it into Excel. All I want from the listing are the files’ name.
Right now I print the listing and key in the name of the files in a
spreadsheet. This is very time consuming and subject to errors.

Can I copy the "Directory Listing" and paste it into an Excel spreadsheet?
If so how?

I am using Windows XP SP 2 Home

Thank you.

 
Reply With Quote
 
 
 
 
GHalleck
Guest
Posts: n/a
 
      21st Oct 2006

Felix wrote:

> I know how to print a “Directory Listing” but instead I would like to copy
> and paste it into Excel. All I want from the listing are the files’ name.
> Right now I print the listing and key in the name of the files in a
> spreadsheet. This is very time consuming and subject to errors.
>
> Can I copy the "Directory Listing" and paste it into an Excel spreadsheet?
> If so how?
>
> I am using Windows XP SP 2 Home
>
> Thank you.
>


This is one method. From the Command Prompt, go to the folder
or directory. Type DIR and re-direct its output to a *.TXT
file, e.g., dir >mylistings.txt. Start Excel, locate this
text file and open it. All of the DIR information should show
up in columnar form. Some parsing may be necessary.
 
Reply With Quote
 
Dave Cohen
Guest
Posts: n/a
 
      21st Oct 2006
GHalleck wrote:
>
> Felix wrote:
>
>> I know how to print a “Directory Listing” but instead I would like to
>> copy and paste it into Excel. All I want from the listing are the
>> files’ name. Right now I print the listing and key in the name of the
>> files in a spreadsheet. This is very time consuming and subject to
>> errors.
>>
>> Can I copy the "Directory Listing" and paste it into an Excel
>> spreadsheet? If so how?
>>
>> I am using Windows XP SP 2 Home
>>
>> Thank you.
>>

>
> This is one method. From the Command Prompt, go to the folder
> or directory. Type DIR and re-direct its output to a *.TXT
> file, e.g., dir >mylistings.txt. Start Excel, locate this
> text file and open it. All of the DIR information should show
> up in columnar form. Some parsing may be necessary.


If you use the /b switch, dir/b >dir.txt, you will get a bare listing.
See if this suits your needs. Type dir /? to see other switches and options.
Dave Cohen
 
Reply With Quote
 
=?Utf-8?B?RmVsaXg=?=
Guest
Posts: n/a
 
      21st Oct 2006


"GHalleck" wrote:

>
> Felix wrote:
>
> > I know how to print a “Directory Listing” but instead I would like to copy
> > and paste it into Excel. All I want from the listing are the files’ name.
> > Right now I print the listing and key in the name of the files in a
> > spreadsheet. This is very time consuming and subject to errors.
> >
> > Can I copy the "Directory Listing" and paste it into an Excel spreadsheet?
> > If so how?
> >
> > I am using Windows XP SP 2 Home
> >
> > Thank you.
> >

>
> This is one method. From the Command Prompt, go to the folder
> or directory. Type DIR and re-direct its output to a *.TXT
> file, e.g., dir >mylistings.txt. Start Excel, locate this
> text file and open it. All of the DIR information should show
> up in columnar form. Some parsing may be necessary.




Thanks "GHalleck"
 
Reply With Quote
 
Trevor
Guest
Posts: n/a
 
      21st Oct 2006
On Sat, 21 Oct 2006 10:46:21 -0700, GHalleck
<(E-Mail Removed)> wrote:

>
>Felix wrote:
>
>> I know how to print a Directory Listing but instead I would like to copy
>> and paste it into Excel. All I want from the listing are the files name.
>> Right now I print the listing and key in the name of the files in a
>> spreadsheet. This is very time consuming and subject to errors.
>>
>> Can I copy the "Directory Listing" and paste it into an Excel spreadsheet?
>> If so how?
>>
>> I am using Windows XP SP 2 Home
>>
>> Thank you.
>>

>
>This is one method. From the Command Prompt, go to the folder
>or directory. Type DIR and re-direct its output to a *.TXT
>file, e.g., dir >mylistings.txt. Start Excel, locate this
>text file and open it. All of the DIR information should show
>up in columnar form. Some parsing may be necessary.


If you go here:
http://download.microsoft.com/downlo...ertoySetup.exe

download then install.

then when you are in explore you can right click the directory and
choose "Open command window here".

then use the following for only the filenames. By using the /b switch
it uses the bare format of file lists.

dir /b > filelist.txt

Then as mentioned above you can either cut and paste the list or
import it.

There may be some free utilities out there to simplify this but
perhaps others can direct you to those. These steps are certainly less
labor intensive then hand typing them in from scratch. lol

Good Luck,

Trev
 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      21st Oct 2006
Felix

Several methods to accomplish this.......I like Tushar's best if importing to
Excel.

To add a "Print Directory" feature to Explorer, go to
this KB Article.

http://support.microsoft.com/default...EN-US;q272623&

Or you can download Printfolder 1.2 from.....

http://no-nonsense-software.com/freeware/

I use PF 1.2 and find it to be more than adequate with custom
features.

OR Go to DOS(Command) prompt and directory.
Type DIR >MYFILES.TXT

All the above create a *.TXT file which can be opened in Notepad or
Excel.

One more method if you want to by-pass the *.TXT file and pull
directly to Excel is to use Tushar Mehta's Excel Add-in. This allows filtering
and sorting once you have the data in Excel.

http://www.tushar-mehta.com/ scroll down to Add-ins>Directory
Listing.

Download the ZIP file and un-zip to your Office\Library folder.


Gord Dibben MS Excel MVP

On Sat, 21 Oct 2006 10:25:01 -0700, Felix <(E-Mail Removed)>
wrote:

>I know how to print a Directory Listing but instead I would like to copy
>and paste it into Excel. All I want from the listing are the files name.
>Right now I print the listing and key in the name of the files in a
>spreadsheet. This is very time consuming and subject to errors.
>
>Can I copy the "Directory Listing" and paste it into an Excel spreadsheet?
>If so how?
>
>I am using Windows XP SP 2 Home
>
>Thank you.


Gord Dibben MS Excel MVP
 
Reply With Quote
 
=?Utf-8?B?RmVsaXg=?=
Guest
Posts: n/a
 
      22nd Oct 2006
Thanks guys for all your help.

I’m partly there. I did download the “CmdHerePowertoy” application and used
it to open the “Command Prompt” window with the correct directory path. But
I’m stuck after Trev’s instruction to use the b switch, that is after typing
“dir/b>filelist.txt”. What do I have to do to open the listing after that?

Please note that I don’t know MS-DOS.


"Trevor" wrote:

> On Sat, 21 Oct 2006 10:46:21 -0700, GHalleck
> <(E-Mail Removed)> wrote:
>
> >
> >Felix wrote:
> >
> >> I know how to print a “Directory Listing” but instead I would like to copy
> >> and paste it into Excel. All I want from the listing are the files’ name.
> >> Right now I print the listing and key in the name of the files in a
> >> spreadsheet. This is very time consuming and subject to errors.
> >>
> >> Can I copy the "Directory Listing" and paste it into an Excel spreadsheet?
> >> If so how?
> >>
> >> I am using Windows XP SP 2 Home
> >>
> >> Thank you.
> >>

> >
> >This is one method. From the Command Prompt, go to the folder
> >or directory. Type DIR and re-direct its output to a *.TXT
> >file, e.g., dir >mylistings.txt. Start Excel, locate this
> >text file and open it. All of the DIR information should show
> >up in columnar form. Some parsing may be necessary.

>
> If you go here:
> http://download.microsoft.com/downlo...ertoySetup.exe
>
> download then install.
>
> then when you are in explore you can right click the directory and
> choose "Open command window here".
>
> then use the following for only the filenames. By using the /b switch
> it uses the bare format of file lists.
>
> dir /b > filelist.txt
>
> Then as mentioned above you can either cut and paste the list or
> import it.
>
> There may be some free utilities out there to simplify this but
> perhaps others can direct you to those. These steps are certainly less
> labor intensive then hand typing them in from scratch. lol
>
> Good Luck,
>
> Trev
>

 
Reply With Quote
 
Ayush
Guest
Posts: n/a
 
      23rd Oct 2006
Open filelist.txt from that directory.

--
> Ayush [ Be ''?'' Happy ]


For any query, search > www.Google.com
Want to know about a term > http://en.wikipedia.org

Replied To :
-------------------------------------------------------------------------------------

"Felix" <(E-Mail Removed)> wrote in message
news:5CC056DE-57F1-4361-9BDA-(E-Mail Removed)...
: Thanks guys for all your help.
:
: I'm partly there. I did download the "CmdHerePowertoy" application and used
: it to open the "Command Prompt" window with the correct directory path. But
: I'm stuck after Trev's instruction to use the b switch, that is after typing
: "dir/b>filelist.txt". What do I have to do to open the listing after that?
:
: Please note that I don't know MS-DOS.
:
:
: "Trevor" wrote:
:
: > On Sat, 21 Oct 2006 10:46:21 -0700, GHalleck
: > <(E-Mail Removed)> wrote:
: >
: > >
: > >Felix wrote:
: > >
: > >> I know how to print a "Directory Listing" but instead I would like to copy
: > >> and paste it into Excel. All I want from the listing are the files' name.
: > >> Right now I print the listing and key in the name of the files in a
: > >> spreadsheet. This is very time consuming and subject to errors.
: > >>
: > >> Can I copy the "Directory Listing" and paste it into an Excel spreadsheet?
: > >> If so how?
: > >>
: > >> I am using Windows XP SP 2 Home
: > >>
: > >> Thank you.
: > >>
: > >
: > >This is one method. From the Command Prompt, go to the folder
: > >or directory. Type DIR and re-direct its output to a *.TXT
: > >file, e.g., dir >mylistings.txt. Start Excel, locate this
: > >text file and open it. All of the DIR information should show
: > >up in columnar form. Some parsing may be necessary.
: >
: > If you go here:
: >
http://download.microsoft.com/downlo...ertoySetup.exe
: >
: > download then install.
: >
: > then when you are in explore you can right click the directory and
: > choose "Open command window here".
: >
: > then use the following for only the filenames. By using the /b switch
: > it uses the bare format of file lists.
: >
: > dir /b > filelist.txt
: >
: > Then as mentioned above you can either cut and paste the list or
: > import it.
: >
: > There may be some free utilities out there to simplify this but
: > perhaps others can direct you to those. These steps are certainly less
: > labor intensive then hand typing them in from scratch. lol
: >
: > Good Luck,
: >
: > Trev
: >


 
Reply With Quote
 
dontdont@gmail.com
Guest
Posts: n/a
 
      23rd Oct 2006

Felix wrote:
> I know how to print a "Directory Listing" but instead I would like to copy
> and paste it into Excel. All I want from the listing are the files' name.
> Right now I print the listing and key in the name of the files in a
> spreadsheet. This is very time consuming and subject to errors.
>
> Can I copy the "Directory Listing" and paste it into an Excel spreadsheet?
> If so how?
>
> I am using Windows XP SP 2 Home
>
> Thank you.


Two methods.

Method one:
Start->Run->cmd<enter>
CD "C:\Documents and Settings\someusername\somedirectory"<enter>
or whatever path you need to supply to get to the desired directory,
with the
quotes if you have a space anywhere in the path.

DIR<enter>

Right mouse click in the window and a little menu pops up.
Slide the mouse over the "Mark" entry and left click.
Then the highlighting disappears.

Position mouse at upper left corner of file name text.
Left button down and drag to lower right corner and release.
(repeat if needed until you have the names highlighted,
the window can be resized if need be to get the names all in)

Tap the enter key, highlighting disappears, names are in clipboard.

Switch to Excel sheet, click in cell, Control V or Edit->Paste
and you have all your names in your cells.

Method two:
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy/paste listing of filenames to a word document Paul Kraemer Windows Vista General Discussion 2 13th May 2008 03:38 PM
Copy & Paste Object without using the Excel Copy Paste functions =?Utf-8?B?R2Fueg==?= Microsoft Excel New Users 0 10th Mar 2004 07:06 AM
Copy & Paste Object without using the Excel Copy Paste functions =?Utf-8?B?R2Fueg==?= Microsoft Excel Misc 0 10th Mar 2004 07:06 AM
Copy directory listing to text file F. Michael Miller Microsoft VB .NET 11 3rd Feb 2004 09:56 PM
Importing a Directory Listing from CD to Excel Mike Microsoft Excel Programming 2 7th Jan 2004 07:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:35 PM.