|
-
Oct 21st, 2003, 03:44 AM
#1
Thread Starter
New Member
Wildcards in pathname
Is it possible to use wildcards in a pathname? The problem is, I have been asked to create an application using Access that copies files from one folder to another, using the FileSystemObject and then deletes the original files. I can do this no problem as long as the paths to the folders are known. Unfortunately, mine aren't unknown and need to build them up as follows:
If I have a file called PL-50-12345-A.doc, it would be located in:
N:\Products\50 Mechanical Component\50-123xx\50-12345 Plate Mtg Top Slide Proj\Dev (Mech).
The destination folder would be:
N:\Products\50 Mechanical Component\50-123xx\50-12345 Plate Mtg Top Slide Proj\Current
I somehow need to build up this path using the '50-12345' part of the filename. Now I thought this would be possible but it seems that I can't use wildcards in pathnames.
Forgive me if I am mistaken, this is my first attempt at VBA and I think I've been thrown in the deep end!
Any help would be very much appreciated. Thanks.
-
Oct 21st, 2003, 08:10 AM
#2
Frenzied Member
The FileCopy function and/or FSO wont allow wildcards when copying files. It will want accurate filenames.
You can build up the filename using LEFT, MID, INSTR, InStrRev etc. These allow you to to take a string (the full filename and path) and to extract out the bits you want into other strings (the new filename and path you are copying to).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|