Home > ASP Development > unc directory listing?

unc directory listing?



[code]



Hi I have some code which I would like to implement on an intranet site. The code will hopefully display a list of directories and their associated sizes.



the problem I am having is this... my code works when I use the existant server.mappath, but when I try and hard code the path (set allfiles=directory.getfolder(("\\gamma\usrdatauk/"& split_name(num_directory)& "/"))

) it throughs me an error:



Microsoft VBScript runtime error '800a004c'

Path not found



/mail/directory_size.asp, line 36 [/INDENT]

the directory structure I wish to browse is on a file server in the DMZ of our corporate network so to connect I would have to use a username and password, I do not know where I must specify this information?



<%



script_name=request.servervariables("script_name")

split_name=split(script_name,"/")

num_directory=ubound(split_name)-1



%>

<html>

<title>CodeAve.com(Directory Size)</title>

<body bgcolor="#FFFFFF">



<table align="center">

<tr>

<td width=150>

<b>Directory</b>

</td>

<td width=150>

<b>Megabytes</b>

</td>

<td width=150>

<b>Kilobytes</b>

</td>

<td width=150>

<b>Bytes</b>

</td>

</tr>

<%



set directory=server.createobject("scripting.filesystemobject")

set allfiles=directory.getfolder(("\\gamma\usrdatauk/"& split_name(num_directory)& "/"))

for each directory in allFiles.subfolders

if right(directory.Name,3) <> "cnf" then

total_size=total_size + directory.size %>



<tr>

<td width=150>

<%= directory.name %>

</td>

<td width=150><%= formatnumber((directory.size/1024/1024),2) %></td>

<td width=150><%= formatnumber((directory.size/1024),0) %></td>

<td width=150><%= formatnumber(directory.size,0) %></td>

</tr>

<% end if 'end check for FrontPage directories

next 'end of the for next loop %>

<tr>

<td width=150><b>Total</b></td>

<td width=150><%= formatnumber((total_size/1024/1024),2) %></td>

<td width=150><%= formatnumber((total_size/1024),0) %></td>

<td width=150><%= formatnumber(total_size,0) %></td>

</tr>

</table>



</body>

</html>



[code]

    
Guest


This particular piece of hardcoded info seems like it would never work right as it has backward slashes and a forward slash:



\\gamma\usrdatauk/

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved