Ever wanted to send a list of the movies you have to one of your friends? Or maybe wanted print a list of MP3 files that you have, Or share a list of albums with your friends on the internet? But copying the file or folder names one by one would take so much time, and it is boring!
So here’s the easy and quick way to do it on Windows and Linux OS…
To make a list of files and folders in a directory simply follow these steps:
Type “cmd” without quotes and hit enter
Now you need to navigate to the directory you wish to print the contents of. Type the letter of the partition where your folder is e.g. “D:” Now you’re in partition D. Simply use the “cd” command to reach the folder you want then enter the following command..
dir -o -b > list.txt
Now you’ll find a new file “list.txt” created in the directory and has a list of files and folders name in this directory.
Let me explain what this command means, You can skip that part if you’re not interested.
dir is the command used to list the contents of a directory
-o to sort the files in the list by name. Use
-s to sort them by size and
-e to sort them by extension.
-b this means you want only the files or folders names without any other infomation.
> list.txt This indicates the name of the new text file you want to the list to be generated into. In this case the generated file name will be “list.txt” and this file will be generated in the directory you’re creating the list from.
Tips for advanced users:
You can create a batch file “.bat” with the command above and save it in your windows folder, Then in Windows Expolorer go to Tools > Folder Options > Types tab > then click Folder.
Click the Advanced, Then “New” like in this image..
Now when you right-click on directory you should see a new option “Create File Listing”. Piece of cake, Isn’t it?
Go to the directory you wish to list the contents of. If you’re new to Linux, you will need to learn about the “cd” command and the “ls” command.
Once in the directory you wish to print the contents of, simply type that command
ls > list.txt
That will print or list the files and folders in the current directory to a new file named “list.txt” file.