Ver Mensaje Individual
  #2 (permalink)  
Antiguo 28/07/2004, 14:25
Avatar de AlZuwaga
AlZuwaga
Colaborador
 
Fecha de Ingreso: febrero-2001
Ubicación: 34.517 S, 58.500 O
Mensajes: 14.550
Antigüedad: 24 años, 2 meses
Puntos: 535
El código sería así:


<%
Dim FSO, oCarpeta, colFicheros, fichero, oFichero
Dim sContenido

set FSO = Server.CreateObject("Scripting.FileSystemObject")
set oCarpeta = FSO.GetFolder("C:\My Documents")
set colFicheros = oCarpeta.Files

'Recorremos la colección de ficheros (objetos File)
for each fichero in colFicheros

if fichero.Name="a.txt" then
'Abro el fichero para lectura (ForReading)
set oFichero = FSO.OpenTextFile("C:\My Documents\a.txt",1)

'Leo todo el fichero a una variable
sContenido = oFichero.ReadAll

response.write sContenido

'Cierro el fichero
oFichero.Close
set oFichero = nothing
end if

next 'fichero

set colFicheros = nothing
set oCarpeta = nothing
set FSO = nothing

%>