Link to home
Start Free TrialLog in
Avatar of niidmore
niidmoreFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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
Avatar of hielo
hielo
Flag of Wallis and Futuna image

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")
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
Avatar of niidmore

ASKER

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
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
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.
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

ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes, you are not setting uname on every iteration!
silly me ... did not really notice that i am doing this mistake ! thanks for pointing that out Rob !
No problem. Thanks for the grade.

Regards,

Rob.