473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 2226
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

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

Similar topics

2
by: Lin Ma | last post by:
Greetings, Is it possbile to check a file exist without using Server.CreateObject("Scripting.FileSystemObject") in asp page?? The reason is our hosting company turn that function off for...
3
by: Matt | last post by:
<input type="file" size=50"> will produce the browse button and browse text box. The user can either select the file from browse button, or enter a path in browse text box manually. My question...
7
by: andylcx | last post by:
Hi all: The c++ language can check whether the file exist or not. I am wondering how c language does this job? Thanks a lot! Andy
3
by: Dave | last post by:
How can i check to see if a link (file) exist while a web page is loading. If the page doesn't exist - i want the hyperlink to go an error page telling the user the link doesn't exist otherwise...
52
by: paytam | last post by:
Hi all Can anyone tell me how can I check that a file exist or no.I mean when you use this commands FILE *fp; if(!fp) //Could not open the file doen't show why it can not open it,may be the...
2
by: tino | last post by:
I use File.Exist to check whether a certain image exists. Upon successfull check I want to use the file further but I always get a "The process cannot access the file because it is being used by...
14
by: John Salerno | last post by:
What is the best way to check if a file already exists in the current directory? I saw os.path.isfile(), but I'm not sure if that does more than what I need. I just want to check if a file of a...
1
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
Hi, Anyone know of a folder equivalent to File.Exist(file) ? regards Jesper.
6
by: Franck | last post by:
i have already a way to know if a file is there by using System.Net.WebRequest.Create(strURL); the problem come when checking for huge file. How do i manage that. because the code define over...
8
by: Anthony Papillion | last post by:
Hello Everyone, I'm writing some code that needs to check if a file exists or not. I'm using the System.IO's File.Exist() method and it's either misreporting or I am not fully understanding how...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.