News, tips, advice, support for Windows, Office, PCs & more
Home icon Home icon Home icon Email icon RSS icon

We're community supported and proud of it!

  • Copying Folder Names Into Excel

    Home Forums AskWoody support Microsoft Office by version Office 365 and Click-to-Run Copying Folder Names Into Excel

    Viewing 3 reply threads
    • Author
      • #2334767
        AskWoody Plus

        Is there a way to copy Folder names (not file names) into Excel 365 without using macros? I am running Windows 10 and Office 365. I could use a 3rd party software if it was free. Thanks for any help you might offer.

      • #2335084
        AskWoody Lounger

        You can use Total Commander, which is shareware that you can try with no limitations. In Total Commander, highlight the folders whose names you want to copy. Then click MARK and then COPY SELECTED NAMES TO CLIPBOARD. Another option is COPY NAMES WITH PATH. Once in Clipboard, paste into Excel spreadsheet.

      • #2335096
        Paul T
        AskWoody MVP

        Open a PowerShell window.
        Type: dir C:\MyDir -Attribute d -Recurse

        This will list all directories and you can then cut and paste. If the list is too long, add a pipe to the command to send it to a file.
        Type: dir C:\MyDir -Attribute d -Recurse | out-file c:\temp\dir.txt

        cheers, Paul

      • #2335107
        AskWoody MVP

        Or you could use this powershell:

        $x = (Get-ChildItem -path "G:\BEKDocs" -directory -recurse -depth 2).FullName | Sort
        Set-Clipboard -Value $x


        • -Path – sets the base path, i.e. top directory/folder.
        • -Recurse parameter to have the code look at all levels below the specified path level.
        • -Depth – can be used to control how far down the chain -Recurse works.
        • Pipe output to Sort ( | Sort ) to get your directories in sorted order.

        Example output:

        G:\BEKDocs\2020 Tax Statements
        G:\BEKDocs\Access\Access Documenter
        G:\BEKDocs\Access\Code to Test
        G:\BEKDocs\Access\Exported Modules
        G:\BEKDocs\Access\Working Backups
        G:\BEKDocs\BTB\Home Mgmt
        G:\BEKDocs\BTB\Image and Video Tools
        G:\BEKDocs\BTB\Maintanence\Backup Tasks
        G:\BEKDocs\BTB\Maintanence\System Information
        G:\BEKDocs\BTB\Maintanence\Tuning Utilities
        G:\BEKDocs\BTB\Office Tools
        G:\BEKDocs\BTB\Tips Docs

        HTH 😎

        May the Forces of good computing be with you!


        PowerShell & VBA Rule!
        Computer Specs

        1 user thanked author for this post.
    Viewing 3 reply threads

    Please follow the -Lounge Rules- no personal attacks, no swearing, no politics or religion.

    Reply To: Copying Folder Names Into Excel

    You can use BBCodes to format your content.
    Your account can't use Advanced BBCodes, they will be stripped before saving.