Solved

Headaches with FolderExists and FileExists

Posted on 2014-01-08
3
146 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
  • 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
dog bark java program 15 82
isEverywhere  challenge 19 64
URL to download Windows 10 Home 2 96
C# code editing and collaboration 3 47
This is a little timesaver I have been using for setting up Microsoft Small Business Server (SBS) in the simplest possible way. It may not be appropriate for every customer. However, when you get a situation where the person who owns the server is i…
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

758 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

19 Experts available now in Live!

Get 1:1 Help Now