Solved

File System Object - How to encode path with spaces

Posted on 2004-03-24
13
784 Views
Last Modified: 2006-11-17
This should hopefully be easy...

If I use the following:

Set folder = fso.GetFolder("C:\Test\")

There are no problems, however if I change the directory to the following:

Set folder = fso.GetFolder("C:\Documents and Settings\Bill\My Documents\My Pictures\")

I get a "path not found error" or more specifically:
Microsoft VBScript runtime (0x800A004C)
Path not found
/alpha/UploadFromFolder.asp, line 110

I'm thinking it has something to do with the spaces in the filename since this is really the only difference (besides length).  Does anyone have any suggestions?

Thanks!
0
Comment
Question by:willy6743
  • 5
  • 2
  • 2
  • +3
13 Comments
 

Author Comment

by:willy6743
ID: 10673697
Looking at this a little further, I found that the path works up to the following point:

Set folder = fso.GetFolder("C:\Documents and Settings\Bill\")

However it is after I try to go another level deeper, I run into the problems.  Is this a security issue?  And if so, how can I get around it so that I can point to the 'My Pictures' folder?

Thanks!
0
 
LVL 4

Expert Comment

by:AsbjornG
ID: 10674012
Try this, it's the way windows would want you to write it:


Set folder = fso.GetFolder("""C:\Documents and Settings\Bill\My Documents\My Pictures\""")

Cheers,

Asbjorn
0
 

Author Comment

by:willy6743
ID: 10674378
I gave that a try and got the same error message.  It didn't seem to mind the extra quotes but it also did not accept them.

Thanks.
0
 
LVL 3

Expert Comment

by:xiong8086
ID: 10674641
use SERVER.URLENCODE("")

Set folder = fso.GetFolder(SERVER.URLENCODE("C:\Documents and Settings\Bill\My Documents\My Pictures\")),

;-)
0
 
LVL 4

Expert Comment

by:AsbjornG
ID: 10674704
How about this? (My local setup is bugged, so I'm afraid I can't test myself at the moment)

dim strDir

strDir = "C:\Documents and Settings\Bill\My Documents\My Pictures\"

Set folder = fso.GetFolder(strDir)

Asbjorn
0
 
LVL 6

Accepted Solution

by:
BAlexandrov earned 50 total points
ID: 10675027
Yes, it is permissions issue of course! To profile for every user by default have access only this user (and administrators)
Set correct permissions on folder and it will work. You will have to add IUser*** user (or Guests group) to have read or write access or choose different directory.

Bojidar Alexandrov
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 7

Expert Comment

by:TheKenman
ID: 10675852
Set folder = fso.GetFolder("C:\Documents%20and%20Settings\Bill\My%20Documents\My%20Pictures\")
0
 
LVL 6

Expert Comment

by:pillbug22
ID: 10677295
I would agree with BAlexandrov.  It is probably a security issue, especially if your web page is running under the default IUSER account (whihc woudn't have access to those foldes unless you specify so).

If you are using Basic or Windows Integrated login, you'll have to make sure the user has access as well.
0
 

Author Comment

by:willy6743
ID: 10678299
I will be unable to test until tonight, but I believe you are right with the security issue.  

Is there any way to run a certain page as a user other than IUSER?

I will try setting the IUSER security to this account.  Also, does anyone know of a fast way to change the security settings for a folder without actually going to the properties of the folder and doing this all manually?  Maybe by using a reg file with the registry or with command line commands (maybe a .bat file)?  I was thinking that I would like to have something in the future that will automatically set all of the properties of folders that I am concerned with at once.

I'll reply this evening on what I find out.  Thanks for all of the suggestions!
0
 
LVL 6

Expert Comment

by:pillbug22
ID: 10678395
* Is there any way to run a certain page as a user other than IUSER?

If you need anonymous connections available, you can go into IIS and change the user account for the connections (change it from IUSER to another user account).

If you are on an intranet site, you could try using Windows Integrated Login, which passes through the credentials of the user currently viewing the page. (Also true if you use Basic Authentication).


* Also, does anyone know of a fast way to change the security settings for a folder without actually going to the properties of the folder and doing this all manually?

This is possible by using some Windows Scripts, but I think that would probably be best suited for another question (integretiy of EE PAQs)
0
 

Author Comment

by:willy6743
ID: 10678861
Great info...Thanks!  And I will post elsewhere for the folder permissions question.
0
 
LVL 6

Expert Comment

by:BAlexandrov
ID: 10679529
* Is there any way to run a certain page as a user other than IUSER?
in addition
If you disable anonimous access and enable Basic Authentication and/or Windows Integrated auth you will be asked to authenticate befoer going to page and script will work with your account.

* Also, does anyone know of a fast way to change the security settings for a folder without actually going to the properties of the folder and doing this all manually?
Only will mention that command line utility for that is called "cacls'
0
 

Author Comment

by:willy6743
ID: 10680122
Thanks BAlexandrov and pillbug22 for the info.  I'm sure this is the problem so I have accepted BAlexandrov's answer before spending the time to test it.

Thanks!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now