|
-
Aug 18th, 2006, 02:04 AM
#1
Thread Starter
Junior Member
File Name Retrieval
Hi,
I need some help on retrieving file names in a specific location, the only problem is the filename is relevant to the machine I am connecting to, so need some sort of wild card option to search for the constant in the file name, and then pull back the full name.
As an example, if I have a number of machines names computer001 through to computer100, and each machine has a file named computername_status.log (eg computer089_status.log) how can I look for the _status.log part of the filename and then return the complete name to my script?
It's not a simple as getting the computername as this is an example, the file I'm after is a filename followed by a random 3 figure number.log hence the wild care requirement.
I hope this is clear in what I am trying to do...
Thanks.
Last edited by fireblade; Aug 18th, 2006 at 03:56 AM.
-
Aug 18th, 2006, 02:43 AM
#2
Re: File Name Retrieval
VB Code:
myfile = Dir(path & "*._status.log")
will return the first file in the path that matches, calling Dir after (ususally in a loop) will get the next etc.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Aug 18th, 2006, 03:08 AM
#3
Thread Starter
Junior Member
Re: File Name Retrieval
So simple it's genius, thanks...
Resolved
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
|