Author |
Topic  |
|
quince
Junior Member
 
Canada
103 Posts |
Posted - 27 March 2007 : 18:07:30
|
Dear All,
I need to open a file with the FSO where this file starts with CDR, i only got to open this file by typing the whole name of it and it's name is going to vary everytime so i won't be able to open it. please i need to help me to get the code how to open the file which starts with CDR
here is the code
<% set FSO = Server.CreateObject("Scripting.FileSystemObject") path = "C:\Inetpub\wwwroot\test\CDR\CDR_CF0741.D00.32.255"
set file = fso.opentextfile(path,1)
do until file.Atendofstream
response.write(file.readline & "<br>")
loop
file.close set file = nothing set fso = nothing %>
as you will see the name of the file is strange CDR_CF0741.D00.32.255 and every time the numbers will be change except the CDR,
thanks in advance, Best Regards, Quince |
|
Doug G
Support Moderator
    
USA
6493 Posts |
Posted - 27 March 2007 : 19:48:47
|
Use the filesystem object to open the folder containing the file(s) in question, read all the filenames in the folder, and save the filenames of any that match your criteria in an array. Then go through the array and open the file using the complete filename.
|
====== Doug G ====== Computer history and help at www.dougscode.com |
 |
|
quince
Junior Member
 
Canada
103 Posts |
Posted - 27 March 2007 : 19:51:35
|
Hello Doug G, thanks for your reply, but this folder will contain only this file and each time i check it, it will be deleted so is it possible to open it without using the array ???
|
 |
|
quince
Junior Member
 
Canada
103 Posts |
Posted - 27 March 2007 : 20:07:21
|
Hey Doug G thanks for the information, while it is the only file in the folder i get the file name and insert it in the path and it's working fine
thanks again,
|
 |
|
|
Topic  |
|