Joined: 25 Sep 2007
|Posted: Mon Jan 23, 2017 7:09 pm Post subject: Save list of files as csv or txt from MS dos command line
|First open the MS-DOS prompt
Click Start > type cmd and press Enter.
The dos command prompt opens. In my case, it always opens with the default directory path
So type cd.. and press Enter, it will move you one level up.
Now if you type dir and press Enter, you will get the list of folders and files under C drive
Change the default drive
By the way, I want to change my drive from C to E. So type E: and press Enter
I could do it at the beginning as well, but I wanted to show you few other steps like going up one level in the directory path at a time.
Now navigate to your folder
Now let me navigate to my folder
I get list of all folders and files in E drive but I want to go to my specific folder called ExcelTest
E:\> cd ExcelTest [enter]
To list the files and folders contained in ExcelTest enter
To list the files in the main folder as well as in all the subfolders enter
Save the list either as .csv or .txt file
Now, first I will save all the files and folders in ExcelTest as .csv (comma separated values file) and .txt (text) file
Now you will find both the mytest.csv and mytest.txt files in the ExcelTest directory. Click them to open – csv files open in Excel and txt files open in text editors.
But if you want to save all the files in the subfolder together with the main folder then enter
The files are now saved in your ExcelTest directory. Click them to open.
Clean the command prompt
By the way, your command prompt is now full of lists from directories, folders and files: - and now you want to clear all these contents, so enter
It will clear all the contents from the dos command prompt. cls stands for clear screen.
Close the command prompt
To close the command prompt type exit and press Enter
Read wonderful articles (English & German) on Science & Tech, Environment, Health and many other topics only on BlogArena.
For comments of suggestions, please contact us: firstname.lastname@example.org