Pages

Tuesday, July 10, 2012

How To Copy Directory’s File Names In A *.TXT

Sometimes you are willing to organize your ideas in office but you don’t know how to figure out it. In fact, a good starting point could be understanding the structure and amount of data you have stored in your personal computer. We often have folders, sub-folders and several files without any kind of order or sorting criteria. However, if you need to have a quick view of everything you have in a specific folder, a simple but powerful *.bat file can solve it immediately. 


MS-DOS is still alive

Believe it or not, MS-DOS commands are still very powerful and they can help you to get amazing results in just a code line. As matter as fact, the following is a great example of that. What if you are allowed to list all your folders, files and subfolders contained in your computer?

1.   Create a new *.txt file: Once you have opened just introduce the following DOS Commands.  Use DIR /B /O:N /S > OutPut_File.txt. This line makes the famous DIR command which is capable to make a list of everything you have located in the current directory. In this case, we have added /S to also include subfolders.  Using the sign “>” we are indicating to save or output a new file which will have the name and format we want.

2.    Save file in *.bat format: Even though you have created a *.txt file you must save the new file in a *.bat file writing manually this extension. Once you have saved the file, you’ll notice that it will get different icon showing its traditional MS-DOS look.

3.   Run the file: Now that you’ve created the new *.bat file, is time to try and see if everything is OK. Just clicking the *.bat file, it automatically will generate the file named OutPut_File.txt where you see the aforementioned list. Try yourself and leave your comments if everything goes well.

0 comments: