09stephenb
09stephenb

Reputation: 9836

Batch writing file names to a text file

I have a folder "C:/files" it will have say 10 files in it how would I write the files name to a text file called files.txt. I need it so the names are all in septate lines so it will look something like this.

file1
file2
file3
ect

Thanks if any one can help.

Upvotes: 1

Views: 9924

Answers (1)

herohuyongtao
herohuyongtao

Reputation: 50717

Under the folder (cd into it, or simple in the folder, SHIFT+Right click and select Open command window here), you can run the following dos command:

Dir /b *.* > list.txt

P.S. if you need the full path of each file, you can add extra /s option:

Dir /s /b *.* > list.txt

Upvotes: 7

Related Questions