c# get path without filename

    string fileAndPath = @"c:\webserver\public\myCompany\configs\promo.xml";

    string currentDirectory = Path.GetDirectoryName(fileAndPath);

    string fullPathOnly = Path.GetFullPath(currentDirectory);

4.5
6
AQuee 75 points

                                    var fn = openFileDialogSapTable.FileName;
var currentPath = Path.GetFullPath( fn );
currentPath = Directory.GetParent(currentPath).FullName;

4.5 (6 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
get file name without path c# get filename without path c# c# file name without path c# path without filename c# get file name without path get directory without filename c# get full path from path without filename c# c# get path without file c# get directory name without path how to get only path without filename c# c# get file path without filename c# get filenames from directory without path c# get file without path c# path get filename without extension c# path get path without filename get path without filename c# get directory path without filename c# c# path get directory without filename c# get file name from directory without path c# get path to file without filename c# path get without filename get filename from path without extension c# c# get filename from path without path get full path without saving to a directory c# c# filename from full path c# remove filename from file path c# get file path without file name how to get the path of a file in c# get path c# select filename with path c# c# get path from filename c# path only filename get file name of path c# c# get system path get path for path with filename c# get path of directory c# get path without file name c# path to filename c# c get filename from path c# get file from path c# get filenames from path how to c sharp file name c# get app without filename get the file path without filename in c# c# get filename from path c# fileinfo filename without path c# find path of file application by name how filename from path c# c# file name from path filename string to correct C# path get path is a directory without filename c# extract path from string c# c# get path without filename c# get the path of a path and file name get path from full filename c#
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source