Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Headaches with FolderExists and FileExists

Posted on 2014-01-08
3
Medium Priority
?
154 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 1200 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 1200 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

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
This video teaches viewers about errors in exception handling.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

670 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