How to get the full directory path
source link: https://www.codesd.com/item/how-to-get-the-full-directory-path.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
How to get the full directory path
I have create a directory name 'DbInventory' in E drive of my machine Now in my c# application I want to get the full path of this directoty(DbInventory).
bellow I am mentioning the code I have used
DirectoryInfo info = new DirectoryInfo("DbInventory");
string currentDirectoryName = info.FullName;
But this currentDirectoryName string return the file location in C drive.
First of all, DirectoryInfo
constructor takes parameter as a string with full path. When you just write a folder name, it gets the location of your Visual Studio's default path which is most common in your C:/
drive and under Bin/Debug
folder.
So in my computer, your currentDirectoryName
will be;
C:\Users\N53458\Documents\Visual Studio 2008\Projects\1\1\bin\Debug\DbInventory
If you want to get full path name, you can use Path.GetDirectoryName
method;
Returns the directory information for the specified path string.
Related Articles
How to get the full file path from the Google Drive via java
How to get the home directory path in App.config?
How to get the full file path (image file) using AngularJs
Extension with image: How to get the full image path in the model?
How do I get the full directory path of the current file in Python?
How to get the web directory path from Entity?
How to get the full file path using the input type file in javascript?
How to get the parent directory in Python?
How to get the complete directory in Java with the file name
How to get the full web address with BeautifulSoup
How to get the isolated storage path to access files and folders in the Windows Phone7 application?
How to get the full path to archive that & ldquo; know & rdquo; when working in the debugger
How to get the full path to a file in VBScript?
android: how to get the full path of a file stored in a folder in sdcard?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK