Hi. Rookie here...
I have a LARGE text document that is actually the result of executing a DOS "dir /s" command and outputting it to a text file.
This file contains the following pattern repeated MANY times...
Directory of <directory name>
... <list of files>...
<# of files> File(s) <# of bytes> bytes
I want to create a Macro - or VBA code - that deletes the list of files, for EACH of the above blocks, and leaves me with the following...
Directory of <directory name> <# of bytes> bytes
Directory of <directory name> <# of bytes> bytes
...
Directory of <directory name> <# of bytes> bytes
This way I have a list of just the directory names and their sizes.
I imagine the following steps in my Macro:
1) Go to the next occurrence of "Directory of"
2) Go to the End of line
3) Delete from current location to the next occurrence of "File(s)"
4) Loop back to Step 1
I have tried recording a Macro to do this, but I get stuck at Step 3 above.
Can I do this with a Macro? If not, can someone post a VBA snippet that will do the job, if it's not too complicated?
If I should move this post to the VBA part of this forum, I'm happy to do so, but I was hoping I could get away with recording a Macro.
Thx,
feenyman99