Is it possible to loop through a directory with subdirectories containing multiple .csv files and delete them if a certain text string is found inside each file?
Is it possible to loop through a directory with subdirectories containing multiple .csv files and delete them if a certain text string is found inside each file?
yes, it is possible
Here's one way to do it.
It needs the reference to Microsoft Scripting Runtime selected (early binding).
Select the top folder when prompted and the text string to look for, and it will loop through all subfolders and files looking for .csv files with the specified string in the active sheet*
* if there are multiple sheets in the file and you need it to search in all sheets, then let me know
Please Login or Register to view this content.
Hi !
For a faster process you can avoid external FileSystemObject library and just use Dir VBA function and Open statement …
That's true, but if speed is what you are after then I believe to start with you should filter these files out rather than loop through all subfolders, i.e.
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks