Ecco un semplice script per vedere, con struttura gerarchica, tutte le sottodirectory ed i relativi files contenuti, sfruttando la ricorsione ed il File System Object.
<% Dim FileObject Set FileObject = Server.CreateObject("Scripting.FileSystemObject") StrPath = Server.MapPath("/") call GetFiles(StrPath) call GetFolders(StrPath) Set FileObject = Nothing Sub GetFiles(strPath) Set f = FileObject.GetFolder( strPath ) Set fc = f.Files Response.write "Ci sono " & fc.Count & " files<BR>" For Each f1 in fc 'if instr(f1.name, ".zip") then Response.write "<li>" & f1.name 'end if Next Set fc = Nothing Set f = Nothing End sub Sub GetFolders(strPath) Set f = FileObject.GetFolder( strPath ) Set fc = f.SubFolders For Each f1 in fc Response.write "<li>" & f1.name Response.write "<ul>" call GetFiles(f1) call GetFolders(f1) Response.write "</ul>" Next Set fc = Nothing Set f = Nothing End sub %>
Commenti
Per inserire un commento, devi avere un account.
Fai il login e torna a questa pagina, oppure registrati alla nostra community.
Approfondimenti
Nessuna risorsa collegata
I più letti di oggi
- Vuoi incontrare Bill Gates? Viaggia con ASPItalia.com!
- Customizzare il pager del DataGrid
- Stabilire un collegamento VPN tra una Web App e una Virtual Network
- Documentare ASP.NET Web API con Swagger
- Usare i servizi REST di BING per ottenere informazioni sulla posizione dell'utente
- Visual Studio 2005 CTP May