Tech
Forums
Jobs
Books
Events
Live
Interviews Prep
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
7
Reply
using one variable to store two different paths of a folder
Eline Sami
Aug 19 2014 3:51 AM
812
Reply
Hi
I have one specific folder which might be found on two different locations (depends on the operating system that is being used)
I need to set a code which checks those two locations and see if the folder exists in one of them and after that my code will use the path to get the files inside that folder.
Example:
string SourcePath; // It can be @"
C:\Program files
or @"
C:\Documents or settings
so I need to use one single variable and store the paths in in order to use as following:
if
(System.IO.
Directory
.Exists(SourcePath))
{
string
[] files = System.IO.
Directory
.GetFiles(sourcePath);
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
7
)
Next Recommended Forum
I have a scenario in C# using linq... pls guide me
printing invoice