Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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

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

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, fsosourcePath = "C:\Program Files\Software AG\Natural\Natapps\Fuser"
targetPath = "E:\natural backups\"
overwrite = trueSet 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

Hi Michael
I did exactly what you said before reading your reply and it works like a charm.
Thanks anyway for the response.
Noody

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
pauseTo 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

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |