i have two different server one is a webserver and the other is a storage server,
in my web page using vbscript, i was trying to read the files inside the storage server but i keep getting invalid directory or file not found
this is the way i did it. could you tell me how to fix this thank you very much.
please help me asap. thank you very much
set objFSO = CreateObject("Scripting.FileSystemObject")
set objFile = objFSO.GetFile("\\server2\images\folder1\)
set objFolder = objFile.ParentFolder
set objFolderContents = objFolder.Files

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jared LukerCommented:
It's probably a permissions issue.  The file and folder permissions have to be set up so that the anonymous or authenticated user account has at least read access to it.  If it does not, then Windows will deny access to the file.

The file also has to be in a location that the web server can access.
StewSupportAuthor Commented:
how do i set it up then?
Jared LukerCommented:
well.. I only know how to do it with IIS.

If you are using anonymous access, then you need to set NTFS permissions on the folder1 that would give the anonymous account access to that file.

If you need to know how to set up NTFS permissions, there are lots of articles here on EE and on the web to help you with that.
You are missing a filename in your GetFile call, but I guess you must have omitted that on purpose?

First, test straight from a VBS file, outside a web browser, from the desktop, to see if you've got the code right, then work permissions for the web page later.

Try something like this.


Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("\\Server2\Images")
For Each objFile In objFolder.Files
   WScript.Echo objFile.Path

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.