vb123.com.au
In Access Unlimited - Edition 36 the following was written about listing the files in a folder. The readers of the newsletter came up with a number of other alternatives that are also shown.
Method 1
Janet wrote, maybe you already know this but I often need a list of
files in a directory/folder. Usually I do a screen dump but that's
a bit of a pain, especially when there is more than a screen full of
files and it's not much good if you want to annotate the list.
The procedure is:
* In DOS go to the directory which has the files you want to list
* Enter command: DIR > "filename".txt
Eg DIR > listfiles.txt
* The txt file called "listfiles.txt" will be created in the directory
you are listing
ED: This is a good hint that I have used once every 3 months for
15 years. I usually add the brief extension to this command dir/b
to remove the file
size from listing. The > letter in the dos command is a
signal to Dos to
pipe the preceding command into the file. The biggest
challenge in Dos
these days is moving to the correct directory in the first place.
Method 2
Hello
Garry,
I read with interest the item submitted to the access newsletter by Janet showing how to obtain a directory listing from DOS. You commented on the difficulty of drilling to the correct directory. I too use the redirection feature of DOS on a regular basis. Having recently installed Windows XP and the power Tools, I found a feature called "Open Command Window Here". Simply right click on a directory displayed in the left hand pane of Explorer and select "Open Command Window Here" and hey presto a DOS box CD'd to the required directory.
Keep up the good work. Geoff
Method
3
Outlook does a good job on this
Click
Other shortcuts.
Navigate to folder
Press Print button
Select Table Style and OK
Gives a neat table of your folder contents
Stephen Jones
Method 4
From the latest newsletter you talked about the DOS DIR>Filename.txt thing. Have a look at a tool called Explorer Extensions at http://www.rjhsoftware.com/rjhextensions/. I've been using this for quite a while. You can just right click in Explorer and save the directory list to a file, or print. And do a few other useful things from Explorer. It's a handy tool.
Owen Jenkins
Method 5
I was
reading this afternoon the latest newsletter Edition 36, keep up the good work
by the way, excellent reading :-D
Anyway to my point, when reading "LISTS OF FILES IN A FOLDER" you described a
way of getting a list of files from a folder, using a DOS command. Have lived
and breath "Windows" most of my computing life, it was news to me. Just 2 weeks
ago l had to overcome the same challenge e.g. list of file in folder in my case
over 1,400 of the little blighters !!! A search using "Google", helped me find
"File List 1.00", I've included the addresses below. Fantastic, tried, works,
and its.............FREE !!! (sorry LOL). A good example for me of programming
should be, it works, looks good, and easy to use. Also has a nice file explorer
window, and don't have to use, nasty "CD" line command :-D. This is one program
that is going into my toolbox :-D. Maybe this will be of help to someone
somewhere.
http://members.tripod.com/~happy_dude/index.html
http://www.btinternet.com/~happydude/oldprogs/filelist.zip
Method 6
In DOS
you can use the full folder names if you use quotes, e.g.:
C:\> CD "C:\My Documents\My Library\Annotations"
C:\My Documents\My Library\Annotations>
That way you don't have to play with the 8.3 names, e.g.:
C:\> CD C:\MYDOCU~1\MYLIBR~1\ANNOTA~1
This works in Win98SE, I haven't tried it on other OS's.
Michele Skabialka
Method 7
At http://www.terabyteunlimited.com/utilities.html you will find a free utility called "Drop To Dos". The details on the site are as follows:
"With Drop to DOS, you can right click on any folder and choose the Drop to DOS option to take to you a command prompt within that folder. Works with Win9x / WinME / WinNT/2K/XP."
You might also like to check out the shareware "DirList" at http://windowsutilities.com/dirlist.html, which
"provides user descriptions of files and subdirectories for printing or documentation."
and the freeware "DirList at http://www.simtel.net/pub/pd/18209.html:
"Use DirList to list all file and directory names in a directory. You can also select to view any or all of the following: file size, file date, creation time, and file attributes (Archive, Hidden, Read-Only, and System). The directory listing can be sent to the default printer, or the clipboard."
Haven't tried them yet, but they sound as if they will do the job.
If you're brave, you can create your own directory/file lister batch file.
One is described at http://www.computerbits.com/archive/2002/1000/bair0210.html.
Another is at Geocities
Hope this helps.
Steve Pitt
Method 8
Garry, In regards to your suggestion to Janet concerning "LISTS OF FILES IN A FOLDER"
I agree that it is difficult at best to navigate to the proper folder when at the DOS prompt. To alleviate this hassle I been adding two options to the Right Click Menu of all drives and folders since I can remember: one that opens a DOS Window in the folder I right clicked on and the other that list the contents of the folder in a text file.
To add these commands in Windows 9x:
Start-----------------------------------------------------------
Open Explorer and choose Tools | Folder Options | File Types and click on "Folder" (not "File Folder" its only applies to file folders - not drives). Then click on "Edit" and "New". Once the dialog opens enter these values:
Action:
DOS > here
Application Used to Perform Action:
command.com /k cd "%1"
Click "OK"
Click "New" again and enter these values:
Action:
List Contents
Application Used to Perform Action:
command.com /c DIR /s /v > FolderList.txt
(NOTE: "/s" will include all of the subfolders and their contents and "/v" will include the long name of the contents)
Click "OK" three times
Finish-----------------------------------------------------------
Unfortunately This was much too easy so Microsoft changed it and Windows 2000 and XP don't display this option but this registry edit method works on all version of Windows:
Start-----------------------------------------------------------
Open your Registry using RegEdit (not RegEdit32), and find the key HKEY_CLASSES_ROOT\Folder\shell. Create a new sub key called "DOSwindow" as in HKEY_CLASSES_ROOT\Folder\shell\DOSwindow.
Change the value of "default" within the key to equal the text you would like on the right-click menu, for example 'DOS > here'. Create another new subkey under the key you just created, and name this subkey "command" as in HKEY_CLASSES_ROOT\Directory\shell\DOSwindow\command.
Change the value of "default" within this key depending on your OS to equal either:
Windows 9x: command.com /k cd "%1"
Windows NT/2k/XP: cmd.com /k cd "%1"
Create a new sub key called "ListContents" as in HKEY_CLASSES_ROOT\Folder\shell\ListContents.
Change the value of "default" within the key to equal the text you would like on the right-click menu, for example 'List Contents'. Create another new subkey under the key you just created, and name this subkey "command" as in HKEY_CLASSES_ROOT\Directory\shell\ListContents\command.
Change the value of "default" within this key depending on your OS to equal either:
Windows 9x: command.com /c DIR /s /v > FolderList.txt
Windows NT/2k/XP: cmd.com /c DIR /s /v > FolderList.txt
Close RegEdit.
------------ Finish
Now right click on a folder and look for the options.
I used to add one that prints the contents directly to the printer but I decided a long time ago that it is better to first view how big that printout is going to be before proceeding with it! If I want to print the contents I choose List Contents and then just open the resulting file which takes but a few seconds to display in the window.
Thanks for all your great tips, news and links!
I hope this helps someone reduce their frustration!
John R Bartow
WinHaven Consulting LLC
Click on the
button for the next links page.
Get Good Help Here
If you need help with a database or
Office programming,
our Professionals could be the answer because we have worked on many
similar solutions
Frontpage Conversions
We have converted vb123.com to Expression Web,
contact us if we can help you move to the latest Microsoft web tool.
About The Editor ~ Contact Us
Garry Robinson writes for a number
of popular computer magazines, is now a book author and has worked on
100+ Access databases. He is based in Sydney, Australia