Forum Index
shamskm.com Home
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Save list of files as csv or txt from MS dos command line

 
Post new topic   Reply to topic     Forum Index -> Technology & How-To Forum
View previous topic :: View next topic  
Author Message
Admin
Site Admin


Joined: 25 Sep 2007
Posts: 272

PostPosted: Mon Jan 23, 2017 7:09 pm    Post subject: Save list of files as csv or txt from MS dos command line Reply with quote

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

C:\Users\mybook99>

So type cd.. and press Enter, it will move you one level up.

C:\Users\mybook99>cd.. [enter]

C:\Users\>cd.. [enter]

C:\>



Now if you type dir and press Enter, you will get the list of folders and files under C drive

C:\>dir [enter]



Change the default drive

By the way, I want to change my drive from C to E. So type E: and press Enter

C:\>E: [enter]

E:\>


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.

C:\Users\mybook99>E: [enter]

E:\>







Now navigate to your folder

Now let me navigate to my folder

E:\>dir [enter]

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]

E:\ExcelTest>



To list the files and folders contained in ExcelTest enter

E:\ExcelTest>dir [enter]



To list the files in the main folder as well as in all the subfolders enter

E:\ExcelTest>dir/s [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

E:\ExcelTest>dir>mytest.csv

E:\ExcelTest>dir>mytest.txt

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

E:\ExcelTest>dir/s>mytest2.csv

E:\ExcelTest>dir/s>mytest2.txt

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

E:\ExcelTest>cls [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

E:\ExcelTest>exit [enter]






*Recommended:

Read wonderful articles (English & German) on Science & Tech, Environment, Health and many other topics only on BlogArena.

For comments of suggestions, please contact us: info@shamskm.com
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Technology & How-To Forum All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group