Click here to Skip to main content
15,878,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to use a folder in remote pc on my local network
i already ensure all the permission and remote pc share the folder also i add the code on web config
identity impersonate="true"
but whenever i want to access the the folder it gone to the C: path.
How can i access the folder
path = "\\HP-PC\\GetFiles";
String[] fileNamesWithoutExtention = Directory.GetFiles(@path,      "*.jpg").Select(fileName => Path.GetFileNameWithoutExtension(fileName)).ToArray();

Here the PC Name HP-PC
Folder Name GetFiles
Error:
Could not find a part of the path 'C:\HP-PC\GetFiles\'.

I will be thankful if anybody help :)
Posted

1 solution

The problem is with the escape characters defined in path variable. Try this:

C#
string path = @"\\HP-PC\GetFiles";
            String[] fileNamesWithoutExtention = Directory.GetFiles(@path, "*.avi").Select(fileName => Path.GetFileNameWithoutExtension(fileName)).ToArray();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900