free file directory listing tool

2 Tricks Save Explorer Search Results to Excel or App

How to get Windows File Explorer search results as a list of files in Excel, Outlook, Word, or Notepad. It is not immediately apparent from within File Explorer, and I’ll show you a combination of two excellent tricks that get your files and list them in Excel. I use MS Excel mostly but you can past your search results into any App. It is easy enough so that almost anyone can do it so read on.

Introduction – Save Explorer Search Results to Excel or Other App.

Often we make a search in File Explorer, but how do you make it into a useful list to use in another application like MS Excel? You can to select multiple files when you click-hold and drag the mouse over several files. When you try to copy, you get a copy of the files not a copy of the list of them. There doesn’t seem to be any handles on that list of nor obvious way to grab it to copy it.

In this article l show you how to create a list of File Explorer Search results and paste in Excel, Outlook, Notepad or Word. You do not need programming nor Excel macros when you use two tricks I show that make it easy.

Some of you may be wondering ‘How can I get a list of files in a folder?’ You can follow my steps below to do that easily without using command windows or special directory tree software.

Along the way, we answer the questions:

  • How to save File Explorer Search Results as a List?
  • How do I save Windows Explorer search results?
  • How do I save search results in Windows 10?

Are there limitations?

The steps below help you to get a list of Explorer search results (or any directory listing) into Excel, Outlook or other application with Windows 7, Windows 8 and Windows 10.

Similarly, you may be wondering how to print a listing of folders and sub-folders in a directory. The steps below will show you how once you create a view (or search) in File Explorer that will be the basis for that (hint: search for *.* in your desired folder to get all files).

Here are the steps!

Step 1 – Find The Files in Explorer

First create your search in Windows Explorer.

If you only need to get a list of files in a directory, well you probably already have that without a search! Just locate that directory in File Explorer.

Here is my example. Notice how there are several different folders and paths. My example is more than a simple directory list, and these steps work for those also.

 

File Explorer Search Results list

File Explorer Search Results list. How on earth do you copy a list of the results rather than copy the files themselves (it is not obvious is it)?

Step 2 – Select a File or Folder

Next click on any file within the directory or search results so that you have selected something in the list.

TIP: If you sort your files now (for example in order by size, by clicking at the top of the header) then the list you create will be in that order. It might be handy to think of it at this stage.

Step 3 – Select All or a Group of Files

Now press <Ctrl> + <a> to select all files and folders.

(Just to be clear, that is press the control key and the letter ‘a’ key at the same time.)

Of course, if you choose you can select only the file or folders you want rather than all files and all folders. The following explains how to do that if you are not familiar with it.

To select some adjacent files, click the first, then hold <Shift> and click the last.

To select non-adjacent ones, hold <Ctrl> and click each one you want.

Yes, this can be time consuming, and yet it is quicker than editing and copying each file name (or typing them out) one at a time if you have more than two.

TIP: If you need most of the files in your directory view, it could be quicker and easier to make a list of them all and delete the few you do not want once you have the list in your other application.

Step 4 – Copy the Filenames and Paths

Now here comes the essential trick (trick number 1):

Hold down the <Shift> key and while still pressing it then right-click on a selected file (any file will do if all are selected).

That is <Shift> + Right-Click.

Look down the pop-up menu options list to find “Copy as Path”. See below for an example.

This should be there if you have held down the shift key when you right clicked. See the image below for how it looks in Windows 10. Windows 7 and Windows 8 look a little different, but the shift right-click menu contains Copy as Path.

Get a copy of File Explorer list with shift right click

Trick Number 1 – Get the list of File Explorer Search Results onto the clipboard by holding Shift and right click. Use Copy Path.

This is the key step to export from your File Explorer search results to Excel, Word or other application.

If you do not see ‘Copy as Path’, check again if you still have <Shift> held down when you clicked the right mouse button on a selected or highlighted file.

TIP: If you did not have <Shift> still held down (it is easy to forget the first few times you do it after you learn the trick), simply hold shift and right-click on a selected file (away from the menu that already popped up) so that your file selection remains selected. That could save you having to select specific files again.

Go on, practice it a few times right now, with and without <Shift> held down to observe the different pop-up menus.

Now to be complete and help those with less experience, I will go into some useful detail below on where and how to paste. If you can not wait to see my Special Must-Have Trick number two, get your content on the clipboard first then click to jump straight to trick number two here.

Step 5 – Chose a Destination App

Go to another application into which you want to paste the information.

I prefer Excel, and as you will see it has some advantages, and if you don’t have or don’t want to use MS Office with MS Excel, you can use Word, notepad or your own chosen application.

If you want to email the list, you can paste it into Outlook also.

If you don’t have MS Office at all with MS Word, you can use Notepad.

Step 6 – Find a Clear Location to Avoid Overwriting Any Existing Data

You can use a countless number of Apps into which you can paste the File Explorer list as text.

Here’s how to use Excel.

Open a new sheet (optional really – you can just paste into a clear place in an existing one to avoid over-writing any existing data).

Step 7 – Avoid Releasing the Data From the Clipboard

Avoid moving or copying other data if you need to make space, so your Explorer results are still copied.

With the search results still on the clipboard (that is, in the computer memory) ready to paste, move your cursor or select a cell for the destination and follow the next step.

Note: If you did have to move or copy other data, just go back and repeat step 4.

Step 8 – Paste your File data

Paste, using any way you like.

For example, you can right click on cell B1 (if in Excel) and select Paste from the menu.

You will note you get the full file path and filename of each file from explorer ion a vertical list with one item per cell in subsequent rows.

<Image>

Step 9 – Special Case: Paste Into a Hyperlink

You can paste these as a list into Word, or Outlook. You can also paste into a link that will work for the reader of your document. I go into some detail below, so if you just want to see the special Excel trick jump to that here.

If you have a single file path and file name, you can create a hyperlink in Word or Outlook, then paste the address in the address bar. Do this as follows.

In Word, click ‘Insert’ on the ribbon menu bar, then ‘Hyperlink’ (often displayed with an icon that looks like two chain links or that plus a mesh globe).

Alternatively you can right click, then select ‘Hyperlink’ from the pop-up menu.

The ‘Insert Hyperlink’ window will open with the cursor ready at the address entry location. Right click and select ‘Paste’ or press <Crtl>+<v>.

paste file explorer search results into word

Paste a single file path here from your results if you want to create a hyperlink in Word or in an email. You can write your own short text to display where you see TheTechMentor.com.

In some cases you will want to get only the file names from the Explorer search, not the entire file path.

To remove the file path you can do several things.

My trick below is the absolute best way to get it, but first here are some other ideas.

You can simply manually delete the preceding text to the left of and including the last backslash. This is reasonable if there are not many to do.

You can try to use text to columns in Excel (but this doesn’t work nicely with a mix of lengths or rather depths of file paths. The final filenames could be scattered in many different columns. It is more of a pain than a help.

The trick below is better for any length or mix anyway.

As I wrote above, I prefer Excel, and this is one reason why.

If you have a long list with multiple sub-folders of different lengths you will need my super formula trick! (Trick number 2!)

Step 10 – Use my Formula Trick to Trim to the File Names Only

Paste all your file paths into Excel (I suggest start at Cell B1).

This is Trick Number Two and is essential if you have a long list and want the file names only:

Copy and Paste my formula below into Excel (I suggest Cell A1).

To use my formula without any editing, you will need to have pasted your Explorer search results path into cell B1, or otherwise you will have a (very minor) action to edit my formula.

That will be easy if you have a basic understanding with Excel cell references.

Do not worry, you do not need to know much about formulas or understand this one in particular. Just paste it (preferred) or type it in (less preferred in case you mistype it).

The formula to paste into Cell A1 is:

=TRIM(RIGHT(SUBSTITUTE(B1, “\”, REPT(” “, 99)),99))

This will work on quite long file names.

See the image below for an example.

Paste formula to get file list only of file epxlorer search

Awesome trick number 2 – Convert your File Explorer Search Results list into a truncated list of files only with my formula. Note the different folder paths and lengths. This formula works with different file name and path lengths, as you will see!

Naturally, if you are familiar with Excel, you can paste this formula anywhere you want. You only need to change a single reference, so it easy.

If you need to, for example if you pasted somewhere else, you can change the cell reference “B1” to wherever the cell is with your first pasted file path and file name.

The rest of the formula works independent of location.

Step 11 – Copy the formula and paste for each File path and name in the list

You can just copy down until you have all cells with your search results converted.

I’ll explain a few ways so anyone can do it. For now see below the results. All file names are shown independent of file path length!

copy formula to create file list from explorer

Copy down the formula. Notice how the file name is created as a list, independent of the length of file path. This trick alone makes transferring any file list from explorer very easy!

If this is too easy for you, you can click to jump straight to how it works here.

One way to do this is select the first cell with my formula and double click when you hover the mouse over the bottom right hand corner of the cell.

To be clear (for those who do not do this often), watch the mouse icon for it to change to cross-hairs.

When that visual signal indicates your mouse is sufficiently over the corner of the cell with my formula, double click. This should fill down the formula as far as Excel recognizes the list of file names and paths from your Explorer search.

Alternatively you can click and drag when the cross-hairs show you are in that bottom right corner position of the cell.

Alternatively you can highlight from the first cell (with the formula) down to the end of your list, then hold <Ctrl> and press <d>. This is the short cut for ‘fill down’ or copy down (‘d’ being for down, not surprisingly!).

There are other ways you can copy and paste your formula down too. Use the method that works for you.

Once you have converted your Explorer file results into Excel, you can copy and paste into any other app like MS Word or Outlook or whatever you need.

Formula alternative

If you have very long file names in your Explorer search results, you might want to use the following variation after pasting your list into MS Excel.

=TRIM(RIGHT(SUBSTITUTE(B1, “\”, REPT(” “, 250)),250))

Again, you can change B1 to your desired cell reference.

These formulae are original for this application, so you will not find them anywhere other than right here on TheTechMentor.com!

Okay, so I promised to explain how it gets the file name only for the list.

How does it work?

It might surprise you that it does work using a formula only, and no macro program. Especially that it works without code.

Well for those of you who are amazed that such a short function can cut the file path to leave only the file name, it is a clever trick and here is how it works.

The ‘substitute’ function places spaces anywhere in the path that has a directory separator (that is, the backslash ‘\’) with many space characters.

Excel generates these spaces by the repeat or ‘REPT’ function (there are a large number of spaces generated this way).

The ‘Trim’ function removes all of the unwanted spaces starting from the right hand end of the string (and you guessed it, the ‘right’ function helps make that possible from the right side) leaving none of the unwanted file path from wherever it starts in the string.

It cuts the right hand side to about the same number of characters as spaces. This means the filename remains and a similar number of spaces (to the file name length) get cut from the last ‘bunch’ of spaces.

This great formula trick is brilliant because it achieves the goal and is quite short. To me it is not so much elegant as industrial.

We blast in bulk spaces then remove the spaces from (a similar distance in from) the right to leave only the file name. Brilliant!

So, that is the second trick required to get your list of directory or search results in File Explorer and copy into Excel or other app.

Background

Every so often when I’m in a new big firm, I search, find and compile an index of the most useful files.

When supporting a large company, I find this is necessary as they have useful documents spread in many different locations (perhaps for their own good reason). I like to create a register of where these files are, their file name, and a link back to them so I can easily find just the ones I need.

I used to find the files I need by using Explorer to search the company drives. There isn’t an obvious way to save just the results in a convenient form, so the question ‘How do I save Windows Explorer search results as a list?’ always used to come up.

I note you can the Explorer search as a search, but that is literally used to get back your search. It might have some use, by my method lets you copy your File Explorer search into any app.

In the old days we could start an MS DOS window, or these days you can use a Command prompt window. However, that is not for everyone, you can’t replicate the equivalent search easily, and my method above is much quicker.

Nothing out there online ever seemed to cover everything I wanted to do, and before I worked out how to do it, it always seemed impossible.

Since I have been using it for some time, and now that I know how, I put it all together for you here. I use it in Windows 10, but I have shown people how to use it within Windows 7, and I’m sure it works in a system with Windows 8.

Another great thing about this method is you do not need special directory listing software!

Your purpose may be different, but it certainly is a useful way to get just what you need!

If you find it handy there is a good chance others will too, so be sure to share this post (via a link) with friends or colleagues whom it might help.

Any hey, if you have your own website, don’t just copy the tricks, give your readers a link to my page for all the details!

Summary of how to save Windows Explorer Search Results in Excel or other Application

This article explains in detailed steps an easy way to get a list of files in a directory or folder. With my two tricks this method is the best way to copy File Explorer search results into Excel to create a directory index or list and to paste in Outlook, Word or other app.

About The Author

Jeff

Jeff (Surname withheld for family privacy) BE. first learned to program in Fortran 77. Most of you will not have heard of that. "Ahh, correction; the very first time I wrote a program it was copied from a book from the school's library into the school's only computer at the time (an early Apple), to make a game using ASCII characters to make a little skier racing down the ski slope and you had to avoid hitting trees!" But it goes to show how old he is! An engineer for over 25 years, as he became more experienced, Jeff was required to review other engineers' work and naturally gravitated to teaching and mentoring others. Jeff grew up and went to college/university before social media could capture it all, he'd prefer to keep it that way now too, for his own and family's privacy. He consciously avoids 'sharenting' too (sharing one's kids photos and life before they determine what they want for themselves). "I don't feel the need to promote myself after a career of more than 26 years. I've done just fine without a Linkedin profile so far, I don't want to start one now...".

Leave A Response

Time limit is exhausted. Please reload CAPTCHA.

* Denotes Required Field