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!

Wildcard for FolderExists 1

Status
Not open for further replies.

parkylad

Technical User
Oct 25, 2001
2
GB
I have been asked to create a script that will allow users to create directories in a jobnumber - clientname format. No problem. I created checking to see whether the directory has already been created to stop users doing it more than once. No problem. My problem is I have been asked to make it so it checks if a directory has been created using just the jobnumber regardless of clientname (as no one job number can have more than one clientname). Not sure of a way round this as, as far as I know, I can't use wildcards with the FolderExists method. Any help would be appreciated.
 
so a directory could be called 001 - bob, 002 - john, 003 - bob,

so you need to check if fileexists for eg.
001 + anyname

i think if you forget fileexists, then

something like construct your own custom folderexists loop

forgive my pseudocode:

you could read all the foldernames into an array then in a loop
xfolderexists = false
for each foldername in array do
read first 3 characters
if 3chars = jobnum then
xfolderexists = true
exit for
end if
next

if folderexists then .... ===============
Security Forums
 
Thanks for that. I had an idea it was something like that but I couldn't get my head round how to structure the code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top