# Worked example - Find the longest file path in your codebase

I recently wanted to know the length of the longest file path within my codebase. Someone was struggling to pull the code to their local machine, and I found that Windows has a 256-character limit for a file path. Well, sort of. It turns out you can edit the registry to remove this restriction in Windows 10. There are instructions at [How-To Geek](https://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/).

If you want to check how long the file paths are, how would you go about it? This is what I did:

1. Use the `dir` command to get a list of all file paths. The [documentation](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/dir) lists various options, but the relevant ones for me were `/S` and `/b` so that subfolders were included and the output only contains the file paths, without additional information.  
    This command should be run at your repository root. You can redirect the output into a text file to make it easier to work with.
    
    ```plaintext
    cd "C:\src\ProjectName"
    dir /S /b > "C:\MyFolder\filepaths.txt"
    ```
    
    This creates a file with contents along these lines:
    
    ```plaintext
    C:\src\ProjectName\File1.cs
    C:\src\ProjectName\Folder\File2.cs
    C:\src\ProjectName\Folder\Subfolder\File3.cs
    C:\src\ProjectName\Folder\Subfolder\File4.cs
    ```
    
2. Copy the contents of the text file and paste everything into excel.
    
3. Use the `LEN` function to get the length of each row.
    
4. Use excel to sort the rows so you can easily find the longest.
