If i have:
C:\temp\foo\bar\
(NOTE: bar is a directory)
how can i parse out:
bar
Click the Start button and then click Computer, click to open the location of the desired file, hold down the Shift key and right-click the file. Copy As Path: Click this option to paste the full file path into a document. Properties: Click this option to immediately view the full file path (location).
To get current file's full path, you can use the os. path. abspath function. If you want only the directory path, you can call os.
The best Linux command to get file path is using pwd command. To use this command, type “pwd” into your terminal and press enter. This command will print the current working directory. The output will be the file path.
The full path name is the path from the root directory (i.e., / ). ./my_script is the relative path name, because the path is given relatively to the current directory, which is denoted by . . So if you are in your home directory the full path is s.th.
I figured it out.
DirectoryInfo info = new DirectoryInfo(sourceDirectory_); string currentDirectoryName = info.Name;
Try
System.IO.Path.GetFileName("C:\\temp\\foo\\bar");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With