Windows – Is it possible to access an NAS drive via CMD and copy all file names from it into a specific file

microsoft-officewindowswindows 7

There is a way within Windows to access a certain folder and copy all of it's contents names into a text file.

For example if I am in C:\Users\myusername\Documents

And in the command line I type dir > C:\dir.txt, when I navigate into the Documents folder, there will be a text file named 'dir.txt', I can now open it and all the names of all the files within my Documents folder will be there (unless thres nothing inside Documents).

My problem is a bit different.

I am trying to access an NAS Drive. The path of the file in my example is \\10.51.0.11\nas\Whatever320\PSTs_from_Whatever.

If I try to navigate here from the command prompt I receive the error:

CMD does not support UNC paths as current directories.

I have many, thousands of file names to copy and paste into Excel from this drive and I need a way of doing it other than manually.

The option of copying and pasting these files is out of the question as it would take many days to make copies from the NAS onto my local network or computer.

Best Answer

You can tell dir what path to list. So you could use:

dir \\10.51.0.11\nas\Whatever320\PSTs_from_Whatever > C:\dir.txt

Related Question