---
title: "How to get the full path of a file?"  
description: "How to get the full path of a file?"  
author: "Utpal Vishwas"  
published: 2023-07-14  
updated: 2023-07-15  
canonical: https://www.mindstick.com/forum/159094/how-to-get-the-full-path-of-a-file  
category: "online file server"  
tags: ["file"]  
reading_time: 2 minutes  

---

# How to get the full path of a file?

How to get the [full](https://www.mindstick.com/articles/12893/experience-the-full-power-of-suitecrm) [path](https://www.mindstick.com/articles/44333/4-expert-tips-on-how-to-pick-the-right-career-path) of a [file](https://www.mindstick.com/articles/59/encrypting-and-decrypting-files-using-c-sharp)?

## Replies

### Reply by Aryan Kumar

There are several ways to get the full path of a file. Here are a few methods:

- **Using the** `Path.GetFullPath()` **method**

The `Path.GetFullPath()` method is a method in the `Path` class that can be used to get the full path of a file. The `Path.GetFullPath()` method takes a file name as input and returns the full path of the file as output.

For example, to get the full path of a file named `myfile.txt`, you would use the following code:

```plaintext
import os

full_path = os.path.GetFullPath("myfile.txt")
```

- **Using the** `GetAbsolutePath()` **method**

The `GetAbsolutePath()` method is a method in the `System.IO.FileInfo` class that can be used to get the full path of a file. The `GetAbsolutePath()` method takes a `FileInfo` object as input and returns the full path of the file as output.

For example, to get the full path of a file named `myfile.txt`, you would use the following code:

```plaintext
import os
from System.IO import FileInfo

file = FileInfo("myfile.txt")
full_path = file.GetAbsolutePath()
```

- **Using the** `.NET File System API`

The .NET File System API provides a number of methods that can be used to get the full path of a file. For example, the `System.IO.Path.GetFullPath()` method can be used to get the full path of a file.

For example, to get the full path of a file named `myfile.txt`, you would use the following code:

```plaintext
using System.IO;

string fullPath = Path.GetFullPath("myfile.txt");
```

- **Using the Windows Explorer**

You can also get the full path of a file by using the Windows Explorer. To do this, open the Windows Explorer and navigate to the file that you want to get the full path for. Right-click the file and select **Properties**. In the **Properties** dialog box, the full path of the file will be displayed in the **File location** property.


---

Original Source: https://www.mindstick.com/forum/159094/how-to-get-the-full-path-of-a-file

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
