If you need to use
OpenFileDialog
for some reason, and the
FolderBrowserDialog
suggested by Abhinav S is not enough, you still can get folder name by using
Path.GetDirectoryName[
^] on the selected file name.
If you need to be able to select
folder and/or file in the same dialog, this can be a solution:
https://github.com/scottwis/OpenFileOrFolderDialog[
^], but there are other solutions too for this task out there...