how to specify network path in getFolder - FSO in ASP

Hello Guys,

Could someone of you please let me know how should I be able to specify path of the different machine mapped on the network in the following line ...

set theFolder = fso.getFolder("R:\\data\users")

where R here is the drive the machine with the IP(10.233.323.26) mapped to.

have tried with the ip but no luck ...
your advice/suggestion is much appreciated.
regards
sam
niidmoreAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
RobSampsonConnect With a Mentor Commented:
Hi, change this line:
filename = uname & ".xml"

to
filename = username & ".xml"

You were using uname, which doesn't have any text in it....

Regards,

Rob.
0
 
hieloCommented:
Have you tried NOT supplying the drive, and use the machine name instead:
set theFolder = fso.getFolder("\\machinename\data\users")
or perhaps:
set theFolder = fso.getFolder("\\10.233.323.26\data\users")
0
 
b0lsc0ttIT ManagerCommented:
niidmore,

If it is mapped to the R drive then what you had is real close.  You use ...

set theFolder = fso.getFolder("R:\data\users")

If you still have a problem then are you sure the IUSR account has access to the drive and share?

Hielo may correct me but I believe UNC paths (i.e. machine name or IP) won't work for the full physical path getFolder and other methods need.  I may be confusing that with another part of ASP though. :)

Let me know if you have any questions or need more information.

b0lsc0tt
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
niidmoreAuthor Commented:
hello guys,
thanks for your replies. have tried with machine name, ipaddress, and the drive name, none works.
yes i do have access to the drive and the  read/write permissions .
can you think of anything else please?
regards
sam
0
 
hieloCommented:
If you type:
\\10.233.323.26\data\users
on explorer, can you get to the files? Not sure but you may actually have to specify the full path. Ex:
\\10.233.323.26\c$\data\users
assuming there exists:
c:\data\users
0
 
RobSampsonCommented:
Hi, if you are executing this code via an ASP page, you may be having permissions issues with the security context of the user using the session.  What are the permissions on your share you want to map to?  Is the IUSR_<SERVER> account listed?

Regards,

Rob.
0
 
niidmoreAuthor Commented:
hello,
guess i better copy all the files to my local PC, edit and write it back to the destination folder .... as this is a one off extract i better dont get into more details .... thanks all for your comments !
however, i am having another problem now, if you could please have a look to the attached script, it should write all the files back to the temp folder instead its just created one single file named ".xml"
not all the files has the content in it, in which it should add a single node <nodeName/>

<%
Dim xmlSource, fso, file, uname
Set xmlSource   = Server.CreateObject("MSXML2.DOMDocument")
Set fso         = Server.CreateObject("Scripting.FileSystemObject")
 
set theFolder = fso.getFolder("E:\users")
 
for Each f In theFolder.files      
      If xmlSource.load("E:\users\" & f.name) Then           
            userName        = xmlSource.documentElement.selectSingleNode("UserName").text    
            groupName       = xmlSource.documentElement.selectSingleNode("GroupName").text          
            excludeUser     = xmlSource.documentElement.selectSingleNode("ExcludeUser").text            
            savedSearches   = xmlSource.documentElement.selectSingleNode("_SavedSearches").text
            userPreferences = xmlSource.documentElement.selectSingleNode("_Preferences").text
            dataAccess      = xmlSource.documentElement.selectSingleNode("DataAccess").text
            pageLength      = xmlSource.documentElement.selectSingleNode("_PageLength").text
            sortField       = xmlSource.documentElement.selectSingleNode("_SortField").text
            listEmail       = xmlSource.documentElement.selectSingleNode("_ListEmail").text
            lastUpdated     = xmlSource.documentElement.selectSingleNode("DateLastUpdated").text
            updatedBy       = xmlSource.documentElement.selectSingleNode("LastUpdatedBy").text
            
            s = s & "<user>"     
            s = s & "<UserName>"&userName&"</UserName>"
            s = s & "<GroupName>"&groupName&"</GroupName>"                  
            s = s & "<_ExcludeUser>"&excludeUser&"</_ExcludeUser>"
            s = s & "<_SavedSearches>"&savedSearches&"</_SavedSearches>"
            s = s & "<_Preferences>"&userPreferences&"</_Preferences>"
            s = s & "<DataAccess>"&dataAccess&"</DataAccess>"
            s = s & "<_PageLength>"&pageLength&"</_PageLength>"
            s = s & "<_SortField>"&sortField&"</_SortField>"
            s = s & "<_ListEmail>"&listEmail&"</_ListEmail>"
            s = s & "<DateLastUpdated>"&lastUpdated&"</DateLastUpdated>"
            s = s & "<LastUpdatedBy>"&updatedBy&"</LastUpdatedBy>"
            s = s & "</user>"
            
            filename = uname & ".xml"
            
            set file = fso.CreateTextFile("E:\temp\" & filename) '"
            file.write s
            file.close
            s = ""
      Else
            Response.Write "We have a problem! Error: " & xmlSource.parseError.Reason & "</br>"
      End If
Next
 
%>

Open in new window

0
 
hieloConnect With a Mentor Commented:
Try setting file to nothing after the call to close:
...
file.close
 Set file = Nothing
0
 
hieloCommented:
Yes, you are not setting uname on every iteration!
0
 
niidmoreAuthor Commented:
silly me ... did not really notice that i am doing this mistake ! thanks for pointing that out Rob !
0
 
RobSampsonCommented:
No problem. Thanks for the grade.

Regards,

Rob.
0
All Courses

From novice to tech pro — start learning today.