Reputation: 141
I am wanting to use the command line to output a list of file names to a CSV, but the files are on a network drive.
On my computer I have a folder of movies on my D: drive. By changing the directory in command line and using dir /b > Movies.csv
I can obtain a list of all movie titles in that directory. However, we now have a WD NAS box with all of our movies in it and I would like to somehow use command line to pull an updated csv of movie names from it. Since it's no longer on one of my drives in my computer, I am unsure of how to do this.
Upvotes: 6
Views: 41280
Reputation: 14809
Simplest thing would be to map a drive letter to the shared drive on the NAS box using Windows Explorer. Then you could do:
dir /b z:\foldername*.* > movies.csv
But the NAS box probably has a name on the network.
Do a NET VIEW command to get a list of connected computers
Suppose the name of your NAS box shows up as NASty
You'd then do NET VIEW \NASTY to get a list of shared resources on the NAS box.
Suppose one of them is moviefolder, identified as a Disk
You could then do
dir /b \nasty\moviefolder*.* > movies.csv
This being Windows, upper/lowercase doesn't make any difference.
Upvotes: 0
Reputation: 1152
Assuming you are talking about windows because you speak of a "D:" drive. You can do the following:
net use X: \\NAS\Share
This will "mount" the \NAS\Share folder to drive "X". Because it is now a drive you can just use regular commands to "cd" to it and then "dir /b > file.csv"
You can also look at https://superuser.com/a/52237/286811 if you do not want a permanent mounted drive.
Even better, I just found out this is also possible
dir /b \\NAS\share
Upvotes: 10