Script to list the files of a folder and export it to a text document
13,719
Solution 1
From the command line (or use a batch file if you're going to need this a lot):
dir c:\users\username > \\server\share\document.txt
that should do the trick
Solution 2
The following command will show all files in the specified directory and all sub-directories and redirect the output to a file on a server share.
dir /s c:\Users\Username > \\server\share\document.txt
Add the /b option if you want to see the files with the full path included in the file name.
dir /s /b c:\Users\Username > \\server\share\document.txt
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Author by
Admin
Updated on June 04, 2022Comments
-
Admin about 2 years
I was just wondering if anyone knew of a way that you could get all the folders, files and sub-folders of a location (such as C:\Users\Username) and export it to a text document on a network share (such as \server\share\document.txt).
Thank you for your help!