
Function: directory-files-recursively directory regexp &optional include-directories predicate follow-symlinks ⇒ ( "#foo#" "#foo.el#" "." "." "dired-mods.el" "files.texi" "files.texi.~1~")Īn error is signaled if directory is not the name of a directory that can be read.

If the order of processing is visible to the user, then the user will probably be happier if you do sort the names. Use this if you want the utmost possible speed and don’t care what order the files are processed in. If nosort is non- nil, directory-files does not sort the list, so you get the file names in no particular order. On case-insensitive filesystems, the regular expression matching is case-insensitive. If match-regexp is non- nil, this function returns only those file names that contain a match for that regular expression-the other file names are excluded from the list. Otherwise, it returns the names relative to the specified directory. If full-name is non- nil, the function returns the files’ absolute file names. By default, the list is in alphabetical order. This function returns a list of the names of the files in the directory directory. Function: directory-files directory &optional full-name match-regexp nosort In the latter case, it can optionally display information about each file, depending on the options passed to the ls command. Directories are a feature of the file system.Įmacs can list the names of the files in a directory as a Lisp list, or display the names in a buffer using the ls shell command.                   test.txt         test1.txtĪs you can see there are many ways to control the listing of a directory by combining the switches together.A directory is a kind of file that contains other files entered under various names.

To do this, you need to use the /A attribute switch which also has other options that you can use:
Windows 7 list directory contents to file how to#
Now that you know how to redirect a directory tree listing to a file, you may want to add more information or sort the information. You can also append more than one directory tree listing to the same file, with out over writing the exisitng contents in the file, using the following command: You can also list any directory tree located anywhere on your computer:ĭir c:\windows \ system32 > c:\myfolder\mydirectory.txt (saves directory tree listing of the system32 folder to the file mydirectory.txt in the myfolder folder) If you want the file created somewhere else other than the current directory, just add the absolute path with the file name.ĭir > c:\mydirectory.txt (file will be created off the root of your C drive)ĭir > c:\myfolder\mydirectory.txt (file will be created in the folder myfolder)

When the command is executed, the file mydirectory.txt will be created (in the current directory you are at) with a directory tree listing. For this we'll use the the redirect symbol > by pressing SHIFT+. Now, to save the results to a file, we'll need to redirect the output to a file instead of the screen.

To display the contents of the directory, we'll use the dir (directory) command. Once the command prompt opens, the current directory will be your user directory. First, open a command prompt by clicking on Start \ Run… and entering cmd in the run box.
