Scenario 1: User wants to list all files from the parent folder only. In this case, all the sub-folders inside the parent folder will be ignored.
Scenario 2: User wants to list of all files in parent folder and their sub-folders.
Let’s take a look in both the scenarios one by one.
User wants to get the list of All files inside a folder
User wants to get the list of all files inside a folder as well as Sub-folders
Free Download – File Manager in Excel
i) VBA code to List all files within a Folder Only
Copy and Paste the below Code and this will list down the list of all the files inside the folder. This will list down all the files only in the specified folder. If there are other files that are there in some other Sub-folders.
Sub GetFilesInFolder(SourceFolderName As String)
'--- For Example:Folder Name= "D:\Folder Name\"
Dim FSO As Scripting.FileSystemObject
Dim SourceFolder As Scripting.folder, SubFolder As Scripting.folder
Dim FileItem As Scripting.File
Set FSO = New Scripting.FileSystemObject
Set SourceFolder = FSO.GetFolder(SourceFolderName)
'--- This is for displaying, wherever you want can be configured
r = 14
For Each FileItem In SourceFolder.Files
Cells(r, 2).Formula = r - 13
Cells(r, 3).Formula = FileItem.Name
Cells(r, 4).Formula = FileItem.Path
Cells(r, 5).Formula = FileItem.Size
Cells(r, 6).Formula = FileItem.Type
Cells(r, 7).Formula = FileItem.DateLastModified
Cells(r, 8).Formula = "=HYPERLINK(""" & FileItem.Path & """,""" & "Click Here to Open" & """)"
r = r + 1 ' next row number
Next FileItem
Set FileItem = Nothing
Set SourceFolder = Nothing
Set FSO = Nothing
End Sub
ii) VBA code to List all files within a Folder and sub-folders as well
Copy and Paste the below Code and this will list down the list of all the files inside the folder as well as sub-folders. If there are other files that are there in some other Sub-folders then it will list down all files from each and Every Folder and Sub-folders.
Sub GetFilesInFolder(SourceFolderName As String, Subfolders As Boolean)
'--- For Example:Folder Name= "D:\Folder Name\" and Flag as Yes or No
Dim FSO As Scripting.FileSystemObject
Dim SourceFolder As Scripting.folder, SubFolder As Scripting.folder
Dim FileItem As Scripting.File
'Dim r As Long
Set FSO = New Scripting.FileSystemObject
Set SourceFolder = FSO.GetFolder(SourceFolderName)
'--- This is for displaying, wherever you want can be configured
r = 14
For Each FileItem In SourceFolder.Files
Cells(r, 2).Formula = r - 13
Cells(r, 3).Formula = FileItem.Name
Cells(r, 4).Formula = FileItem.Path
Cells(r, 5).Formula = FileItem.Size
Cells(r, 6).Formula = FileItem.Type
Cells(r, 7).Formula = FileItem.DateLastModified
Cells(r, 8).Formula = "=HYPERLINK(""" & FileItem.Path & """,""" & "Click Here to Open" & """)"
r = r + 1 ' next row number
Next FileItem
'--- This is the Function to go each and Every Folder and get the Files. This is a Nested-Function Calling.
If Subfolders = True Then
For Each SubFolder In SourceFolder.Subfolders
ListFilesInFolder SubFolder.Path, True
Next SubFolder
End If
Set FileItem = Nothing
Set SourceFolder = Nothing
Set FSO = Nothing
End Sub
File Manager using Excel Macro in Excel Workbook
It looks something like the below:
hey buddy i love this app, gives me a quick way of finding the files that i really need.. Keep up the great work
Thanks Selva !!
mail me in detail how you want to search the file @ info@learnexcelmacro.com
Dear Vishwamitra Mishra,
Excellent work!!!!!!, can you help me to get the pages count of pdf files from the same.
Thanks and best regards
Hi Vish,
This is really a great tool.
Thanks George !!
Dear Sir,
Thanks for this Excel Macro. I need little bit of modification in it. Will you be able to help me on this?
Thanks Prateek !!
Yeah sure, let me know via comment or email me Info@learnexcelmacro.com
Dear Vish Bhaia, I have prepared an excel macro, but need your help to do some modification, I already sent an email to info@learnexcelmacro.com on Sun, Jun 24, 2012 at 11:45 PM
Attached sample .xls also given, please help me…Nur
How can I modify this to search for file types instead of all files?
Hi Vishwamitra,
This is an awesome tool. THANKS for posting it. I am wondering if there is an easy way to export the results into another worksheet? We often use the infomation polled from directories for comparison. Any thoughts?
Thanks again!!!
Rosie
Hi,
Thanks for the feedback. latest version of this tool will solve your problem.
Soon in 2 days the latest version of this tool is coming. Which will have following features:
1. Export in new Worksheet
2. Export in to a text file.
3. Option to choose certain types of files with multiple selection available.
Thanks,
Vish
Fantastic. Thank you.
Hi Kevin,
Now you can download the File manager with the following features from here
1. Export in new Worksheet
2. Export in to a text file.
3. Option to choose certain types of files with multiple selection available.
Thanks,
Vish
Hi Vishwamitra,
I have tried to run the "get the list of files in folder" script. But got the Compiler error User defined type not defined for this line "Dim FSO As Scripting.FileSystemObject".
Please help me with this.
Thanks
Hi Vinod,
Please Check the reference in your excel.
1. Open your Workbook
2. Press ALT + F11
3. Tools –> References –> Select "Microsoft Scripting Runtime"
4. If it is not selected then select it
5. Click OK and your done.
Thanks Vishwamitra.
Problem is solved.
When I try to export in excel I recieve an error "error occured while exporting. try again" and it keeps throwing that at me when trying again.
It s very helpful to me
it will find the files from ftp?
can you tell me how to edit the list to select .mda (Access Files only)
Thanks a lot for this code. Was searching for this type of code since the last two weeks. Made my life simple. Much much appreciated.
The only change I would need is to get the date the file was created instead of date modified?????
Go to the VB Script and add new attribute
like
Cells(iRow, 7).Formula = FileItem.DateCreated
Cells(iRow, 8).Formula = FileItem.DateLastModified
Cells(iRow, 9).Formula = FileItem.DateLastAccessed
Then add corresponding columns in Excel
GREAT Utility … just what I was looking for and more …. MANY thanks for giving the whole package with code AND a working Excel file
Thats a great tool, thanks a lot
Hi,
This tool is simply superb!!!!I was looking for this exactly…you are a genuis..Thanks again
But I have a problem!!!
This tool is not working for excel 2010…when i sort by last modified date…can i give ur email id..i will mail the exact problem to you
this is a great macro and lists all file types and having all files hyperlinked is invaluable. How would you go about adding a page count for the files especially PDFs?
Awesome……really helpful.
Thanks a lot for this good work.
Hi, Thanks for this useful application, but I have problem when opening the file in excel the Microsoft Visual Basic says:
"Compile Error: Method or data member not found"
Any idea?
Thanks
Sorry I didn't mention where exactly is the problem of the error that says:
“Compile Error: Method or data member not found”
The following is marked by the compiler in yellow : Private Sub Workbook_Open()
The following is marked by the compiler in blue : .ListBoxFileTypes
I would be grateful if there is any help. Thanks.
Hi Vishwa
I have found your macro very useful. We need your help to get one functionality for searching only those files which have some particular word in their name. This word can be alpha numeric. Because we are having a system of storing the files with a specific alpha numeric code.
Thanks for macro.
Using Excel 2007 and when click on buttons nothing happens
Hi Vishwamitra,
I downloaded the FileManager – VBA macro and it was great support to us find or list files in directories.
We need to add file types if possible pls let me know how do to.
Regards / Ganesh
Is there a way to retrieve the author of the files? I have been searching for a while and can't seem to find an answer.
Hi Vishwamitra,
Excellent work!!!!!!, can you help me to get the pages count of pdf files from the same.
Thanks and best regards
Hi Vishwamitra Mishra.
Would require to know what files are password protected and what files are not password protected, Please help me this.
Regards
Ravi
Hello,
This code is excellent but I have one question about it. It's possible to get few path (folders) which I want take from them all files with the DateLastModifid ??
Regards,
Bags
Hello Vishwamitra Mishra,
Thanks a lot for the post and the file.
I just wonder if I'm doing something wrong. When I select several file types in the Forms.ListBox to find specific extensions to fetch, and click on Fetch all File Details it doesn't work properly. It doesn't fetch any results apart from RTF files. However, if I select Fetch all File details it works perfectly fine.
Kind regards,
Benjamín
Dear Vish,
It is a great tool and it solved my 3 years of cluelessness as to how to retrieve my endless files that I have stored over a decade. Excellent work.
But I have one last problem. While your macros work like a bullet in Windows, "Browse" command really does not work in Ubuntu CALC. As I am working with Ubuntu, Please suggest how your sheet work in calc (Please note that most of the macros written for Microsoft work in Ubuntu).
Your soulution to this bug will be greatly appreciated.
Doss VA
downloaded and it worked great!
Dear vish ,
This is an amazing work. no words to appericate .
this has reduced my burden in huge level.
Thank you so much
regards
som
You are genius.. You helped me a lot.. Tons of Thanks..!
Thanks John 🙂
Hi, Vishwamitra
Thanks for a very usefull code.
I am a brasilien engineer and I do not know if is my office 2013, but your code do not show anything when I select a file or files types that I know exist in folder. What is happening? Can you get it?
Then for all files type it works and show all!!!
This code needs a reference?
Thanks in advance for your answer, help me, please.
Vilmar
Same problem
This is a great tool to use. I appreciate your help to everyone.
Could you please let me know if I need to get the File Creator/Owner how can I get that?
Dear Ani,
You can get the file creator using builtindocumentproperty.
refer this article:
http://learnexcelmacro.com/wp/2014/06/read-write-document-properties-excel-macro/
Creator details are not stored in the FileItem Object.
Thanks Vishwa..You are really great and helpful. I downloaded your tool and did some modification based on my requirement. Could you please let me know am I good to share this great tool with my office colleague as they also need to do some data extraction from Fileshare.
Thanks Ani for appreciating my effort 🙂 Yes it is a completely FREE tool and you can share with your colleagues 🙂
Really your tool is quite helpful and I am very thankful to you as it saved plenty of my time. It would have been a great help if we had another column with folder name/ Sub-folder name.
Thanks Veera for you feedback. In the next version this will be included. Thanks again.
Thanks
Boss,
Is there any chance on my previous request of having a separate column with folder name/ Sub-folder name.
Hi Vishwa
Thanks for sharing the code!
But there is something needs to corrected onto this file.
when we select particular file on search it throws nothing.but works good with all search.
Please inbox me the correction , urgently needed.
can you please help me to get this data from FTP
Can i find files with particular keyword ?
Thanks very much who have made this sheet. It is very helpfull for me.
Thanks, this is the simpliest code for listing file list
cool brother its help me lot
This is superb, brilliant stuff….Thanks a ton 🙂
Hi, Im getting the Compile error: Method or data member not found. Can you help. Thank you
hi,
The tool is very useful. Can you help me in providing the code for opening the hyperlink and to search the particular string and if it is present. It should copy and paste in another cell
Very useful… Thank you very much.
Hey
I jst want that i m have tif file after segregating that according to need i.e page is form bill or other.i just want according to information those pages moves to form bill and other folder? Can it b done?
Great macro, it works fine when using Excel 2007 but I get an error when using Excel 2013 Unexpected Error (32809).
Thanks
Thank you great file
Thanks Vishwamitra,
This is a life saver.
Hi Dear,
How to add desire file extension in Listfile addin.xlam, kindly let me know this.
Hi, I wonder whether you may be able to help me please. Could you possibly tell me how I would hard code a file type into the script rather than having a tick box for the user to select?
Many thanks and kind regards
Chris
Hi Vishwa,
The Macro works perfectly fine for windows. But I need it on windows. When I tried running it on Mac, its giving erroes.
Need your help regarding this.
I am not into scripting. I am into post productions of films.And need to maintain information of the directories.
Thanks.
Kapil Limbad
Hi Vishwa,
The Macro works perfectly fine for Mac. But I need it on windows. When I tried running it on Mac, its giving erroes.
Need your help regarding this.
I am not into scripting. I am into post productions of films.And need to maintain information of the directories.
Thanks.
Kapil Limbad
Wauw, thanks, this is great!
Thanks Ellen !!
Hi Vishwa,
Awesome macro. But i need a little help in it. i want to list and hyperlink the Folder or Sub folders instead of file type. is there any way of doing it?
Hi I would like to incorporate the search of pics on folders and sub folders using the following macro. As well as file name, date created.
So far this macro will not search within subfolders.
Regards
Sub PhotoCatalog()
Dim i As Double
Dim xPhoto As String
Dim sLocT As String
Dim sPattern As String
sLocT = “C:Documents and SettingslcoloradoBureauL2 Lucien L_Allier (2S50)10.9.8 Photos chantier1-06-2015”
sPattern = sLocT & “*.jpg”
sVideo = sLocT & “*.avi”
Application.EnableEvents = False
Application.ScreenUpdating = False
Range(“A1”).Select
ActiveCell.FormulaR1C1 = “Aperçu/Photo”
Range(“B1”).Select
ActiveCell.FormulaR1C1 = “Lien”
Range(“C1”).Select
ActiveCell.FormulaR1C1 = “Description”
Range(“A1:C1”).Select
Range(“D1”).Select
ActiveCell.FormulaR1C1 = “Avant meulage – Date”
Range(“E1”).Select
ActiveCell.FormulaR1C1 = “Après meulage – Date”
Range(“F1”).Select
ActiveCell.FormulaR1C1 = “Apres injection – Date no.1”
Range(“A1:F1”).Select
With Selection.Font
.Name = “Calibri”
.FontStyle = “Bold”
.Size = 12
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
i = 1
‘On Error GoTo 0
xPhoto = Dir(sPattern, vbNormal)
Do While xPhoto “”
i = i + 1
Range(“B” & i).Select
ActiveSheet.Pictures.Insert(sLocT & xPhoto).Select
With Selection.ShapeRange
.LockAspectRatio = msoTrue
.Height = 74#
.PictureFormat.Brightness = 0.5
.PictureFormat.Contrast = 0.5
.PictureFormat.ColorType = msoPictureAutomatic
End With
Selection.Cut
Range(“A” & i).Select
ActiveSheet.Paste
Range(“B” & i).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, _
Address:=sLocT & xPhoto, TextToDisplay:=xPhoto
xPhoto = Dir
Loop
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Dude This is just freaking amazing!!! do you also teach vba? if yes am interested..
Hello,
This is very useful, thank you very much.
Just a few comments/questions:
– In the version I downloaded, some cells do not have the same format as the others (I know this is not important, I just wanted to highlight it if not noticed yet)
– Why did you not include an application.screenupdating = false/true (and application.calculation) in order to make the process faster?
Best Regards,
Trevor
Dear Vishwamitra,
First of all thanks for sharing such a wonderful utility “File manager.”
But the problem is it works only when option of list all files is selected for selective file extensions such as .pdf or .docx it won’t give any result.
Can you pls sort out this problem.
Thanks in advance 🙂
I have the same problem Rahui only works for .pdf
Hello Vishwamitra Mishra,
I found this very interesting and useful; I am comparing documents in our companies shared drive as well as something called “sharepoint” a file sharing site. It has worked perfectly so far with the shared drive, but I was wondering if it will also take documents from sharepoint?
Thank you soooo much for your help, you have been a life saver!!! 🙂
Jumana
Thanks for the awesome work……u r great.
HI… .. Thank you soooo muchh. for your this post …I am very happy its very very usefull for me..thanks again….. I have one request please if you can help me.. I need one column list in that your Filemanager that contain video’s duration and the size in MB can you please help me?
Thanks in advance .!!!
great work..
may i use some your code?
i promise to keep your name and information on source code
Excellent!! Good Work.. Thanks..
Fantastic, but can anyone assist in converting this for a MAC using a portable harddrive?
Cheers
hello Vishwamitra,
I need a help. how can I copy files from folder and sub folder to another place which is older than 30 days.
The file stops working if the folder has big number of files
lets say above 1000 files
any way to solve this
Awesome bro!!! very nice work….
I do appreciate the lesson man.
I’m aspiring to learn Macros to automate my office work and spend more time in the Site.
Looking forward to learn and improve trough your guidance!
More power and thank you very much.
Hi Vishwa,
The File Manager is a great tool, thank you! I noticed the latest version includes a file type selection. For some reason, the only file type that will pull correctly is the pdf. I have folders with Excel (xls, xlsx, xlsm) and Word documents, image files (jpg, gif, png, etc) but these aren’t fetched with the checkboxes checked. The “Fetch all types” does work.
How do I get the checkboxes to work correctly?
Thank you!!
Jun-Hao Lu
Vishna fantastic work. Can’t say enough. If you ever tweak it could you please allow for showing just the folder rather then or including the path. On a network the path is far too long!! Only asking.
Kind regards
Hats off to you man !! This is amazing work you have done… saved a lot of my time… Thank you so much
You are welcome.. Chetan!!
Thanks Angelo for the feedback. I will consider this in the next version of the tool.
Hi Angelo,
find the line in the code where it says Cells(iRow,4).Formula, and replace it with the code below, that would do what you need.
Cells(iRow, 4).Formula = Mid(FileItem.Path, Len(fPath) + 1, Len(FileItem.Path) – Len(fPath) – Len(FileItem.Name))
Cheers!
Thank you so much I have been giving myself a headache all day trying to get my VBA to work – then I found your file manager
Absolutely superb! Thank you
Hi Vishwamitra, I’ve been searching for a vba solution like this for ages and then you produce this fantastic piece of work, Thank you!
I’m using Excel 2013 and I’m working on a very big project and this would be a great addition to it. Basically, in my vba project I want the end user to be able to select the folder/files in which they wish to import data and your File Manager would do the job. However; when I’ve run it, it’s not listing the .xlsx files within the selected folder. I know that the saved files are .xlsx as I’ve checked and checked and checked again but it just wont list them. Any ideas would be appreciated.
Regards, Pete.
Wow,
What a fantastic piece of work.
Congratulations brother.
Long Live and create such wonderful things.
God Bless
Spectacular! You made this week a whole lot easier on me. Thank you!
Peace,
I would like to build a macro scene shifts to prepare weekly working arrangements for employees .
Section should treat a certain output on a daily basis and contain several conditions inside ,
For example an employee can work up to two evening shifts every week
hi
Great work, I tried to run this macro for subfolders, but I am getting error message saying
ListFilesInFolder not defined.
Please help
Hi,
Just replace ListFilesInFolder with GetFilesInFolder
nice it working
Hi Vishwamitra,
thanks for putting this together, very useful!
However, the tool seems to only work for all files, not if you select only certain filetypes…
any ideas?
There appears to be an error in the code for selecting file types.
I got around this as follows
Find the line below in ‘modFManager’
arrList(j) = Left(Sheet1.ListBoxFileTypes.List(i), InStr(1, Sheet1.ListBoxFileTypes.List(i), “(“) – 1)
Replace the last 1 with 2, so it reads as follows
arrList(j) = Left(Sheet1.ListBoxFileTypes.List(i), InStr(1, Sheet1.ListBoxFileTypes.List(i), “(“) – 2)
This should then work, or at least has for me.
Hello,
thank you for application File Manager, but this fix doesn’t work.
Only PDF documents can filters. Can you put in ListBox XLSM format?
Sure.. it will be available in the next version which I will be publishing it soon.
Hi Vishwamitra,
thanks for putting this together, very useful!
However, the tool seems to only work for all files, not if you select only certain filetypes…
any ideas?
Thank you. Simple to use and exactly what I was looking for. A work of art.
Well done.
Hi Vishwamitra,
Thanks for your great tool. I have a question. I put a number at a specific cell in a specific sheet on every excel file. How to show it on the list?
What do you mean by “How to show it on the list?” which list are talking about? Can you please explain it by providing an example?
Hello!
This is great! Just curious, is there a way to list Folder names, in addition, to the File Names?
Thanks Smith for the feedback. Yes I will publish an article today where you should be able to list folders and sub-folders as well.
Hi Smith,
You can read my new article which is about listing folders and sub folders – http://learnexcelmacro.com/wp/2016/11/list-folders-and-subfolders-in-excel/
Love this app right when I was trying to make something like this you arleady had it done even better. New to VB, I’ve found a way to have macro access secure IP address but I want to be able to pull files from a secure site where i have the access info like cloud or SVN respitory. Is that possible in macro?
Thank you very mach Vishwa….. Highly appreciate
is it okay if I use your VBA folder for work its a really good reference page and was wondering If it was okay If I used it
this is an amazing work. i appreciate very much you sharing it with the rest of the world. i used it to select all the excel files within a bunch of folders and subfolders and sub-sub-folders and added a little extra to resize the page layout for all of them. so thank you. you saved a lot of people from a time-consuming task.
Thank you so much for your lovely words. I am happy to help 🙂
oh my, your program saved me hours of work. so quick, so easy. thank you so much for sharing!
Wao OOO OOo………….. really works, thanks for saving my time
Many thanks for the example spreadsheet, it saves me a lot of time.
I have some feedback, when a file type is selected to fetch using the listbox, no results are returned in the table below. The fetch all types of files works as intended. Any ideas how I could fix this?
Many thanks,
Martin
Hi Martin,
Glad it helped you saving your effort. Soon, I am releasing a new version where this bug will be addressed. Thanks for pointing out.
Hello Vishwa,
The File manager file is very useful to get the required file property. I am not sure how good you are with VBA FTP programming part.
I just wanted to know if it is possible to check the same file present on local server and FTP server and based on which result can get generated.
Can VBA be program to check if file present on FTP is same as local server by File attribute comparison and based on which result is generated such as “Old File on server”,”New file on server”,”File Size is not same”,”File not present on FTP” and so on.
Your help on this will be fruitful
Cheers !
Thanks Abhishek!! I am glad it helped you.
I have never tried connecting to ftp via excel VBA. May be in future, I may have a look and share on this blog. But at this moment sorry, I can not help you.
Suggestion:
You may try these codes shared and let us know if it is working for you. Note: I have not tried this. Before running the code, please take a backup of your workbook. https://www.mrexcel.com/forum/excel-questions/261043-connecting-ftp-excel.html
Hi Vishwamitra
I’m new to VBA (today actually). The tool is amazing, and I was wondering if you might be able to help with a couple of other things that I’d like to use it for re: photographs
1) the dimensions of the photo
2) Date taken
3) Tags
4) Author
5) Title
6) comments
7) adding extra columns for the above and getting them to work (i can’t seem to get this working)
8) new File formats for Office files and video file formats
and if possible exporting a thumbnail of the image into a specific cell in excel corresponding to the details in earlier columns.
Appreciate any help you can offer
Hi Vishwamitra,
I have just downloaded this, great tool. however as others have stated, it does not work when selecting specific file types.
Have you a solution to this yet.
Many thanks
Mike
Superb !! Great tool to get file names from all Sub folders … I was searching this option since long & finally got this ….
Thanks a lot for the wonderful tool..
Thanks Nilesh!!
Hello Vishwamitra Mishra,
Big help not only for me but for everyone.
And everyone waiting for the updates to fix since the last time you update.
Fetching all file types work fine but need to fix selecting some specific file types that doesn’t work.
Its really great and simple. Thanks a lot
HI Vishwamitra Mishra, I have created one excel data file for the calculation of client billing . On my excel formula using =count if funtion I get the result which is desired. (eg. if 100 clients data are available and 25 clients billing date is today, then using =countif formula I get the count as 25)
My main motive is to also show the Client name of that 25 whose billing date is today.
Please help me on this.
This is just Awesome! Exactly what I have been looking for. Thank you!
Hi,
Fantastic code. One thing though. How do you remove the file name from the file path?
Fantastic code. Just one thing though. How do you remove the file name from the file path?
Awesome but wondering how can we exclude the search in subfolders having a specific name. Like all subfolders called Old.
Thxs
I have been looking for something like this (Files from Folders and Sub-folders and list them. It fetches other details of the files as well like File Size, Last modified, path of the File, Type of the File and a hyperlink to open the file directly from the excel by clicking on that.) I clicked on the file (File_Manger) but when I click on “Fetch All File Details” button, nothing happens. Also the downloaded spreadsheet looks different that what is online. Pleas help. Thanks John.
Thank you, this saved me alot of time.
hi ,
When I try to export in excel I recieve an error “error occured while exporting. try again” and it keeps throwing that at me when trying again..
What is going rong on mij computer or Excel/?
Hi,
if you use it for listing folders and subfolders files it only lists the last subfolders files because the “r” variable’ value will be overwritten every time you call the function “GetFilesinFolder”
Thank you
Using Excel 2016.
Getting several problems when trying to When trying to use “VBA code to List all files within a Folder and sub-folders as well”.
1. when i hit run the macro listing window opens but Sub GetFilesInFolder is not listed in box?
2. if I rename to Sub GetFilesInFolder () and comment out (SourceFolderName As String, Subfolders As Boolean) it will try to run, but get a Compile error at ListFilesInFolder?
5/24/2019 Like the site– very user-friendly and a lot of stuff to see!
Thanks Viswa,
Very useful
Aswani
File Manager in Excel has error in date (format).
Hi Viswa. Interesting tool, however ..
I was going to use this to detect duplicates in ANY folder (or location) on my work laptop as I’m not happy with the applications I found online and I’m not allowed to install them on my work laptop anyway..
For accuracy I wanted to include, besides of the file name, the size and date. However some dates are not really dates.. just text. So they produce errors.
It would be good to rectify this.. Also all dates in dd/mm/yyyy would be great!
Cheers.
File Manager Utility is very good, thanks for posting and helping the community.
Look forward for another similar macro for everyday help
Excellent utility. Very helpful. Thanks!
Hello Viswa,
I see people are still commenting here so I’ll give it a shot. I’ve downloaded the tool and it works wonderfully but there is one piece missing. We need to get a list of all folders and files. Unfortunately, the tool does not list empty folders. We verified this today by adding a file to a folder that was empty and had not shown up. As soon as we added a file it showed up. What can we add to get empty folders to show up?
Thank you!
Vishwamitra…sorry.
This is Excellent utility and it Very useful too, I need one modification if you can suggest. I also need to get blank or empty folder/directory list in folder path.
Very smart
The file when I downloaded it fails to work, Excel tried to repair it but nothing worked. The page to download the macro book also failed to load and download.
Thanks for your code. very usefull.
I’ve made a few changes in order to work:
In the second vba code, ListFilesInFolder should be GetFilesInFolder to make the recursive function work and the variable r should be defined as public outside the function, otherwise line are overwritten every loop.
Is there a way to execute the Fetch Files every 10 minutes or so?
HI
This is an amazing work. no words to appericate
This is AWESOME!
Thank you for all of your hard work!
Is there anyway to automate this to fetch files every 10 minutes after pushing the fetch files button?
Hello,
Perfect tool when fetches on local drive in PC. But I have encounter a problem when path is set on server drive folder.
It works but it is very slowly. For example the same folder structure on local drive was fetched let say immediately and for server path it took 14 minutes. Probably “something” on sever side is slowing down the process of getting FileScriptingObjects.
I am not very sure if there is possibility in improving of it.. or maybe I am wrong.
Hello,
I forgot to mention that to fetch folder/file structure from my company server drive was done via VPN and connection was about 6Mb/s.
TI decided to go directly to the company were local drives are on 100Mb LAN. I tried it more times and it took about a few seconds. So it depends on network speed and latency. I have searched for some more info more explain the issue.
See for this one please:
https://stackoverflow.com/questions/18387447/vba-file-system-object-speed-advantages-disadvantages
Maybe in case of network folders it could be solved by uising “Dir” function in looping instead of using File System Objects, e.g.:
https://exceloffthegrid.com/vba-code-loop-files-folder-sub-folders/
Hello,
Definitely using “Dir” function is solution for fetching folders and files!
I have tried something with this one and it is in comparison to FSO very quickly!
Hello,
First of all thank you for this fantastic work!
Is there any way to add more than one searc folder?
Thank you!
hello viswa,
i would like to ask you that is it possible to password protect this files from your sheet only with different passwords.?
please reply….
This tool is really a good one,guess lot of effort been put on to built this…hats off…im trying to check just .txt files but it is not responding when i try to pull in file information from share drive.
Though it works if ‘Fetch all types of File’ is checked.
Thank you very much my friend! it helps me a lot.
But actually i dont need the Files informations, i just need all the folders & sub-folders paths
How do i do this?
If some one needs expert view regarding running a blog after that i advise him/her to pay a visit this weblog, Keep up the
good work.
Great Work, I am so thankful for this work.
Also, I was looking for an excel macro where If we have multiple images like 1000 images in a folder and if I want to search an image, then it will scan the folders and sub-folders and show the path of the relevant nearest match along with the photo.
Is this possible??
When I open this program I get a “Method or data member not found”. in sub routine “Privite Sub Workbook_Open()” on the following line:
Sheet1.ListBoxFileTypes.List = ArrFileType
Thank You
Great.Very Very helpful.
Awesome Tool! thank you for sharing!
Thanks Anand!!