Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 File System Object
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

quince
Junior Member

Canada
103 Posts

Posted - 27 March 2007 :  18:07:30  Show Profile
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  Show Profile
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
Go to Top of Page

quince
Junior Member

Canada
103 Posts

Posted - 27 March 2007 :  19:51:35  Show Profile
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 ???

Go to Top of Page

quince
Junior Member

Canada
103 Posts

Posted - 27 March 2007 :  20:07:21  Show Profile
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,
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.18 seconds. Powered By: Snitz Forums 2000 Version 3.4.07