468,514 Members | 1,427 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,514 developers. It's quick & easy.

How to check file exist if the file starting with certain code?

1
Hi all,

I have a list of files starting with a 4 digit code as below,

1) MI01_xxxx_xxxxx.pdf
2) MI01_xxx.pdf
3) MI01_xxxxx.pdf
4) MI03_xxxxx_xxxxx_xxxx.pdf
5) MI04_xxxxxxx_xxxx.pdf
6) MI04_xxx_xxx_xxxxxxxxxxx.pdf
.......
.......

Is it possible for me to check if the file exist in the directory by checking on the first 4 character of the filename? Based on the list above, if i click on code MIO1, it will list out all files starting with MIO1 (result: 3 files).
If i click on code MI02, it will give message "No files found!".

Expand|Select|Wrap|Line Numbers
  1. Set objFSO = CreateObject("Scripting.FileSystemObject")
  2. If objFSO.FileExists("C:\Inetpub\wwwroot\fin\attach\MI_"&Rs("FinCode")&".pdf") Then
  3.              Response.Write("The file exist.")
  4. Else
  5.     Response.Write("The file does not exist.")
  6. End If
  7.  
Above code is ok if i have the full path. Any idea? Thanks in advance :)
May 6 '10 #1
1 2089
nedu
65
@Adya
can u bit more clear abt the issue . . I doesn't understand what the actual problem is . .

Regards
Nedu
May 12 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by andylcx | last post: by
3 posts views Thread by Dave | last post: by
52 posts views Thread by paytam | last post: by
2 posts views Thread by tino | last post: by
14 posts views Thread by John Salerno | last post: by
1 post views Thread by =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post: by
6 posts views Thread by Franck | last post: by
8 posts views Thread by Anthony Papillion | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.