X

How to copy all file names in a folder

Here I’ll show you how to copy all the file names in a folder in Windows. First you may want to find the folder, using File Explorer. You can’t just select and copy all the files, because you will get all the files with all their content, not the file names only. But it is possible. Read on to learn how.

Contents

The Problem – You want to copy only the file names

Copy all file names in a folder – In quick steps

Get file names from folder with not many file names

Copy names of files in a folder when you have many filenames

Summary

The Problem – You want to copy only the file names

If you just select and copy all the files in the folder, you get all the complete files. Not just the names. You can’t paste it into a list or report. But in this case you want only the names of the files, right?

So how do you do it?

I’ll show you with a few simple steps how to extract file names from a folder rather than the whole files.

In quick steps – copy all file names in a folder:

Step 1

Open File Explorer.

Step 2

Locate the folder you want to extract the list of names from.

Step 3 – Select all files

Select all files. An easy keyboard shortcut is to hold the Control key and press the ‘A’ key.

<Ctrl> + <a>

NOTE: you can hold down the control key and click to select or deselect file by file, if you don’t want to copy them all.

Similarly if there are sub-folders, perhaps you will want to deselect those.

Step 4 – get file names from folder

Here is the special step. There is a hidden away menu that you need to use.

Hold down the Shift key and right-click on any of the files you highlighted in the previous step.

<Shift> + Right Click

Look down the menu until you see “Copy As Path”.

NOTE: If you don’t see that option to copy as path, try again to right click on a different location and make sure you hold down the shift key when you right click.

Remember, if your menu doesn’t look something like this, then you need to hold down the <Shift> key when you right-click. This image is for Windows 10, but you can find something quite similar in Windows 8 and even Windows 7.

Step 5

You now have the file names on the Windows clipboard.

You also have the path of each file name. What does that mean? Well, you’ll see when you paste the files.

Lets say you want to paste into a Word document.

The destination doesn’t matter – this is just for illustration purposes.

You could just as easily paste into an email, a text file or whatever.

Just open the Word document and paste where you want to put the names.

Use any method you are comfortable with to paste. Eg. hold down the control key and then press the “V” key.

<Ctrl> + v

You’ll get something like in the image below.

Here you see we have copied the file name and path, so we get more than the file name when we paste it. You can select the path and delete to extract the file name only.

As you would expect, your list will look different to mine in the image above. If you have very long paths to your file folder, it could look quite messy at this point.

Step 6

Some clean up might be required, because the menu option is ‘Copy as path’, which gives you the entire saved address of each file, not just all the filenames in the folder. Don’t worry I’ll help you with that.

Get file names from folder with not many file names

If you don’t have many files, you can just select and delete the file path in front of each filename.

Copy names of files in a folder when you have many filenames

If you have many filenames copied from the folder, you might want to use a short-cut to automatically remove the file path from the list of file names.

You can do that with a formula in Excel. I’ve already written an article on how to do that. You can copy the formula or download a free spreadsheet with the formula already typed and ready to use.

To get that formula or the spreadsheet, see the linked chapter in this article:

2 Tricks Save Explorer Search Results to Excel -go to formula

If this article helps you, it will likely help someone else you know. Some people are amazed that this little trick exists. Please share it with friends, colleagues and family!

Summary of how to copy names of files in a folder

I’ve shown how to copy names of files in a folder. To extract file names from folder you can’t simply select and copy because it will give you the whole files, not just the files’ names. To extract the filenames, you must copy the file name and path, then extract the name-only part from that.

This post was last modified on March 3, 2022

Jeff: Jeff (Surname withheld for family privacy) is an engineer with over 26 years experience. He first learned to program in Fortran 77! See the 'About Us' for more.
Related Post