[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

trying to write a script that copies files from 1 drive to another

Posted on 2004-11-05
3
Medium Priority
?
292 Views
Last Modified: 2010-04-17
Hello and thanks in advance,

I am trying to write a .vbs script that copies files from one drive to another and matches the folder path exactly. I have bought a scripting book. I am going through the examples and for some reason windows keeps blowing an error @ line 3 of the following code. I understand that just because it says line 3 does not mean the error is in line 3.

Here is the code, can somebody tell me why it keep blowing errors?

'CheckFoder.vbs
folderP = CheckFolders
 ("C:\test\Gen480")
Set W = WScript.CreateObject
 ("WScript.Shell")
w.Popup folderP
Function CheckFolders(folderPath)

Dim fs, f, n, s
s = ""
n = 0
Set fs = CreateObject
 ("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderPath)
If f.IsRootFolder then
s = "this is the root level"
else
 Do Until f.IsRootFolder
  Set f = f.ParentFolder
   n = n + 1
 Loop
 End If
 'work with folder
s = "Folder is nested " & n & " levels deep"

CheckFolders = s
End Function

0
Comment
Question by:Drew_Mora
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
Dang123 earned 2000 total points
ID: 12506709

Try taking the line break out between lines 2 and 3
0
 

Author Comment

by:Drew_Mora
ID: 12506738
Dang123.....you da man! I feel so stupid!!!
0
 
LVL 9

Expert Comment

by:Dang123
ID: 12506762

    Thank you, glad I could help, Thanks for the A   : )
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

In this post we will learn different types of Android Layout and some basics of an Android App.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Six Sigma Control Plans

834 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