Solved

Headaches with FolderExists and FileExists

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
post4 challenge 28 93
EvenOdd challenge 10 92
canBalance challenge 34 70
Determine if SQL is installed in Server 2008 R2 4 57
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 …
Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
This video teaches viewers about errors in exception handling.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

863 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

24 Experts available now in Live!

Get 1:1 Help Now