Computing.Net > Forums > Programming > vb script file

vb script file

Reply to Message Icon

Original Message
Name: noodyblum
Date: December 4, 2006 at 04:48:51 Pacific
Subject: vb script file
OS: windows 2003 server
CPU/Ram: 2 gig
Model/Manufacturer: compaq
Comment:

Hi

I am trying to run the following vbscript file as a windows scheduled task.

The job launches but does not doing any copying.

dim sourcePath
dim targetPath
dim fso
dim f
sourcePath = "C:\Program Files\Software AG\Natural\Natapps\Fuser\*"
targetPath = "E:\natural backups\"
set fso = CreateObject("Scripting.FileSystemObject")
set f = fso.copy (sourcePath ,targetPath)

Help ???

Noody


Report Offensive Message For Removal


Response Number 1
Name: Mechanix2Go
Date: December 5, 2006 at 09:04:28 Pacific
Subject: vb script file
Reply: (edit)

I dunno VBS but it LOOKS LIKE that script sets vars and does nothing else. So I suppose if it's to do some copying, it needs more code.


=====================================
If at first you don't succeed, you're about average.

M2



Report Offensive Follow Up For Removal

Response Number 2
Name: Michael J (by mjdamato)
Date: December 5, 2006 at 13:49:24 Pacific
Subject: vb script file
Reply: (edit)

No, the problem is that you are using just "copy" which requires an OBJECT. You should use copyfolder.

However although the paths you have above should work, thy did not work in my testing. Your best bet is to use this (notice no / at the end of source):
========BEGIN CODE=========
Dim sourcePath, targetPath, overwrite, fso

sourcePath = "C:\Program Files\Software AG\Natural\Natapps\Fuser"
targetPath = "E:\natural backups\"
overwrite = true

Set fso = CreateObject("Scripting.FileSystemObject")

If fso.FolderExists(sourcePath) Then
fso.CopyFolder sourcePath, targetPath
End If
========END CODE=========

However that will copy the source folder and it's contents to the destination, not just the contents of the source.

Michael J


Report Offensive Follow Up For Removal

Response Number 3
Name: noodyblum
Date: December 6, 2006 at 00:43:15 Pacific
Subject: vb script file
Reply: (edit)

Hi Michael

I did exactly what you said before reading your reply and it works like a charm.

Thanks anyway for the response.

Noody


Report Offensive Follow Up For Removal

Response Number 4
Name: tonysathre
Date: December 6, 2006 at 16:05:58 Pacific
Subject: vb script file
Reply: (edit)

Why not just use a batch file?

@echo off

echo Backup Started
echo.
xcopy /y /q "C:\Program Files\Software AG\Natural\Natapps\Fuser" "E:\natural backups\" > nul
echo Backup Complete
pause

To schedule this to run everynight at 10:00 PM run this command:

at 22:00 /every:m,t,w,th,f,s,su "C:\path\to\script\backup.bat"

"Computer security." — Oxymoron


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: vb script file

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge