Solved

File System Object - How to encode path with spaces

Posted on 2004-03-24
13
789 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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/…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

626 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