I'm pretty new to vba excel and trying to reorganise a very large file structure. Basically, all our equipment has a tag in the form of [A-Z][0-9]0-9][0-9][A-Z] e.g. J452G being a compressor. Every equipment has a folder with its name on (e.g. "C:\Users\Ron\Documents\J452G" consist of drawings, subfolders, excels, pdfs,..). The problem is that I would like to copy this equipment folders to a new directory such that all equipment tags have a folder within one single directory (to make alphabetical searching easy). Now these folders are distributed in a tree-like folder structure with lots of subfolders.
What I would like to do is
- Extract the file paths (e.g. "C:\Users\Ron\Documents\J452G") 'This I already managed to do
- Look for the pattern [A-Z][0-9]0-9][0-9][A-Z] and copy all files and subfolders to a new directory with the name of the equipment.
Result should be a main folder (e.g. C:\Users\Ron\Documents) containing a folder for every equipment tag with the corresponding documents enclosed.
I'm particularly stuck on how to extract the pattern [A-Z][0-9]0-9][0-9][A-Z] from a string if found and assigning is to the Destination:=
e.g. C:\Users\Ron\Documents\Nieuwe map \iets\Drogers\F941E\
copy content and subfolders to C:\Users\Ron\Documents\F941E\
Many thanks in advance!
No comments:
Post a Comment