Copying names of files in a folder in a text document. (DOS dir Command)

I received an email the day, from a visitor Stealth SettingsWho asked us this:

[...] I searched the site (that's right, not too much) a tutorial copy the names of files in a folder , in a text document.
Example: I have a folder full of photos: DCS001.jpg, DCS002.jpg. DCS003.jpg, etc..
Well, I want I name these files to appear in a txt like this: DCS001, DCS002, DCS003, etc.. I understand that one can easily solve the cmdBut I did not find how. [...]

Order dir in (CMD) - (MS-DOS Commands) has the role of listing files, folders si subfolders. The command "dir"Like many other commands MS-DOS is present on all operating systems . Windows 95, 98, ME, NT, , XP... and supports a number of command lines (Syntax).

To list files, folders and subfolders in a directory, just open Command Prompt, to navigate to the directory where the files are and to give the command "dir".

Example: On Desktop (Workspace) have folder named "6500. "In folder" 6500 "we 60 files. Jpg (Pictures) and a folder "Test - Stealth Settings. 'If you want to list in CMD and / or export file names inside the folder "6500" in a document. txt, Follow a few simple steps.

* In our case, the "6500" folder has the path (path) D: StealthDesktop6500.

1. open Then go to the directory "6500". (Navigating through command is CMD"cd nume_folder. "To change the partition, enter partition letter and ":", Then press Enter)

* Users who use or Windows 7 CMD can open directly the current folder. Hold down "Shift"> right click > "Open command windows here".

Open Command Windows in Folder

2. Command "dir"List folder contents CMD.

dir show files

3. To Export a list of names of folders and files within the current folder, "6500" in our example into a text file (. txt), give the command "dir> lista.txt".

list - dir

Inside the folder "6500" to create a file lista.txt which contains all file names from folder. In addition to offering information about the volume, date and number.

list - files - dir

Command "dir" supports a number of syntax that helps us in many ways to list and sort liking the results. A series of commands "dir" are only valid for certain operating systems.

DIR Syntax in Windows 95, Windows 98 and Windows ME

[Drive:] - drive letter; [path] - path / location where we want to execute the command.

dir [drive:] [path] / P - Lists the results page. Useful for directories with many files. You need to press any key to move to the next page.


dir [drive:] [path] / W - Multi-column lists results.


dir / A - This ORDERING you should do a specific attribute.
dir / AD - List only folders.
dir / AH - list only hidden files.
dir / AS - lists only system files and folders. System Files.
dir / AR - Lists only the files read-only.

dir / B - Listing files without having to return results on volume and time. Exporting a. Txt we do using dir / B> lista.txt .


More Commands "dir"And Syntaxe supported by this command, find here.

Most syntaxes can be combined to get the desired results. We can sort the files listed by name, volume, date, extension, type ... etc. Some of the command syntax "dir" is not available on Windows Sight yes Windows 7.

Microsoft DOS dir command in Windows XP, Windows View & Windows 7.

Copying names of files in a folder in a text document. (DOS dir Command)

About the author

Stealth LP

Founder and editor Stealth SettingsIn 2006 date.
Experience on Linux operating systems (especially CentOS), Mac OS X, Windows XP> Windows 10 and WordPress (CMS).


Leave a Comment