1

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.

2 Answers 2

4

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

6
  • Thanks for the reply. I don't get the error I used to anymore, however the message I get is 'Access Denied' even when I run CMD as administrator. Sep 10, 2015 at 21:26
  • @SpaceGhost Sounds like you need to ensure you've got proper permission to that folder. Can you navigate to the path via Windows Explorer? Sep 10, 2015 at 21:29
  • @Techie007, Yes, I can. Sep 10, 2015 at 21:31
  • You're correct. I've been an idiot. I can't access it via Windows Explorer. I access this file path via a drive that's shared on our server. The path is a shortcut inside my folder and I navigate to it through that. Thank you for clearing that mistake up. I will attempt something else, if it works, I will post it and accept your answer. :) Sep 10, 2015 at 21:37
  • Ahh, it may be because you're trying to save the dir.txt output file to the root of C:, which is not allowed (that's what's giving you the access denied error). Try just dir \\10.51.0.11\nas\Whatever320\PSTs_from_Whatever on it's own. Does it give you the list? If so, then make a folder and use something like dir \\10.51.0.11\nas\Whatever320\PSTs_from_Whatever > C:\<folder you made>\dir.txt Sep 10, 2015 at 21:37
1

Try below steps,

  1. Use "map network drive" to attach the NAS folder path to a drive name eg. z: or X:.
  2. From the cmd try accessing the network path by typing "z:" and hit enter.
  3. Now you can execute any command you want on the NAS folder

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .