Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax for wildcards. 1

Status
Not open for further replies.

PALman

Technical User
May 15, 2002
160
GB
Can anyone correct the code below to enable me to copy a known file which has variable characters added to the file name after the first 5 characters?
e.g. Filename = C1234 but actual filename = "C1234 UT" or actual filename = "C1234 MP LP"
I assume use of wildcard * or % is used but how is it added to line of code?

filename = NDnumber (ND number + * ???)
FileCopy "\\dept-01\filename", "\\C:\Jobs Folder\" + filename

Any help much appreciated!
 
Have a look at the Dir function ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
How are ya PALman . . .

Have you tried
Code:
[blue]   filename = NDnumber & "*"[/blue]

Calvin.gif
See Ya! . . . . . .
 
Sorry,
filename = NDnumber & "*"
produces "Bad Filename or Number" error.
What it actually does is append asteris (*) to the first 5 characters, thus...
C1234*
So the asteris is not functioning as wildcard.
 
Seems you didn't read my previous post:
filename = Dir("\\dept-01\" & NDnumber & "*")
FileCopy "\\dept-01\" & filename, "C:\Jobs Folder\" & filename

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Sorry PHV
I had to leave my coding problem for a week or so.
However I have just tried your answer and you were spot on.
Your coding works great.
To take things further I need to know how to code wildcards in paths so that a file may be found in any one of a number of folder/paths. So I have started a new thread for this.
Thanks again,
PALman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top