Solved

Headaches with FolderExists and FileExists

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adobe Customization Wizard XI issues 26 255
no14 challenge 14 70
wordlen challenge 3 72
Copy Files - Python 7 86
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 …
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.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

856 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