?
Solved

How to iterate on the files in a directory on DFS Share/ search for a file on DFS Share

Posted on 2008-11-11
4
Medium Priority
?
815 Views
Last Modified: 2012-05-05
This part of code is not working when I give some directory on dfs share ... like \\abc\de\gd\
Can you please let me know what should I use
bool result = !(Directory.Exists(directory));
          
  try
  {
    if (result == false)
    {
       foreach (XmlNode coppFileNode in _coppFiles)
       {
          foreach (string f in Directory.GetFiles(directory, coppFileNode.Attributes["Name"].Value,SearchOption.AllDirectories))
          {
                  //do something
          }
       }
     }
   }
   catch
   {
   }
 
return result;

Open in new window

0
Comment
Question by:chinnu1213
  • 2
2 Comments
 
LVL 12

Accepted Solution

by:
jandromeda earned 2000 total points
ID: 22936899
This should work fine as there is no special code that you have to write to access a DFS share. Just check the user whom under you application runs have access to that DFS share. And I have modified you code a bit to optimize it a bit.

  try
  {
    if (Directory.Exists(directory))
    {
       foreach (XmlNode coppFileNode in _coppFiles)
       {
          foreach (string f in Directory.GetFiles(directory, coppFileNode.Attributes["Name"].Value,SearchOption.AllDirectories))
          {
                  //do something
          }
       }
     }
   }
   catch
   {
   }
 
return result;

Open in new window

0
 
LVL 12

Expert Comment

by:jandromeda
ID: 23200450
I have given a working answer, so I think I should get marks for this.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

750 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question