Writing Out What's in a Folder

by BevCanTech in Circuits > Computers

630 Views, 3 Favorites, 0 Comments

Writing Out What's in a Folder

Mylist1.jpg

It can be useful to write out the contents of a folder from a Windows computer.

For example to list out the music tracks or movies you have in a folder as a text file which can then be printed out.

Here's how this can be done:

i) open windows notepad program
Ii) type: dir > MyFileList.txt
Iii) save the file in a folder you want to list the
contents of calling it: FileList.bat

Save the Batch File

FileList2.jpg

Name the file: FileList.Bat

Run the Filelist.bat Program

FileList3.jpg

Go to the folder you saved Filelist.bat .
Double click Filelist.bat to run it (Windows Batch File)

This will create a new file called MyFileList.txt which lists the files in the current folder.

The filelist.bat program you made is versatile
- it can be copied to another directory and ran by double clicking on it to create a list of files in that directory.

View the File List

FileList5.jpg

Open Myfilelist.txt to see the files listed in the folder. This list can be copied or emailed.

This is an example of a command line (dos) program using a couple of commands:

'dir' to get a list of files in the current folder
'>' to send this list to a file which we named MyFileList.txt

We told the computer this was a command line program by saving the file with the extension '.bat'

It was ran by double clicking on it.

There are other useful commands which can be used in a 'bat' (batch) program, do an Internet search if you want to learn more.