Solved

Headaches with FolderExists and FileExists

Posted on 2014-01-08
3
152 Views
Last Modified: 2014-01-13
Hi All

I'm setting up a vbscript to sweep a Windows folder's contents and FTP any files found, to another location.

The problem I have is that the path of the Windows folder has been set up with a space in it.

As a result, FileExists and FolderExists both give me errors when I check for the folder, or its contents, before doing the FTP.

I've tried removing the space, from the path, on a test system - and this works.
I've tried adding quotes (""") and ("""") and Chr(34) but none of these work.

Bottom line - the space causes the test to fail.

Any ideas how I can get it to work WITH the space in the file/folder path ?

I can't recode the Windows system - it has dependant applications running from it, so these will die if I touch the folder names.

Alternative would be to blindly copy the contents to a temp location - but that defeats the object of having the FileExists and FolderExists test ?

Thanks in advance
0
Comment
Question by:DoveSupport
[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
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
AlexPace earned 300 total points
ID: 39766552
What if you copy them to the staging folder and ignore any copy failures and then test existence in the staging folder... remember to clear it out at the beginning so an old file doesn't hang around.

Another possibility is to use Robo-FTP for this instead... I know I have used it with paths that contain spaces because I am using it to keep a folder updated that is a subfolder located under c:\Program Files (x86)\ on the server.
0
 
LVL 16

Assisted Solution

by:AlexPace
AlexPace earned 300 total points
ID: 39766560
... actually I am pretty sure the FileSystemObject can handle spaces in the path.  

Please be sure this is not a red herring and the real problem is not permissions or something like that.  Maybe try saving the path in a variable and then passing the variable as a parameter?
0
 
LVL 1

Author Closing Comment

by:DoveSupport
ID: 39775975
Thanks AlexPace - it looks like the problem was a dodgy section of program (not sure how), but I retyped the exact same code into another editor and it worked with no hassles . . . this after doing numerous tests with the same code in various parts of the program segments.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

628 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