Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActiveX Script not Workinng.

Status
Not open for further replies.

itsmarkdavies

Programmer
May 22, 2001
87
0
0
GB
I am running an VBScript ActiveX script from a SQL Server 2000 Job Step. The Job runs fine and reports success, but the file I am trying to move does NOT move. Can anyone spot a flaw in my Script ?. Any ideas much appreciated.

Script is as follows :-

Function STAMP
STAMP = FormatDateTime(Date, 1)
Archive "\\SERVER1\c$\bills.txt"
End Function

Function Archive(filespec)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")

If (fso.FileExists(filespec)) Then

fso.MoveFile filespec, "\\SERVER1\c$\archive\bills"
& STAMP & ".txt"

End If

Set fso = Nothing
End Function itsmarkdavies@hotmail.com
 
it will not move the file if the destination file already exists.....
is the file already there?
thats when you ned to use copyfile and not move file then call deletefile on the file you have copied
 
No, the destination file is not already there. That is why I am appending a timestamp to the file to make it`s name unique. We only expect 10 files per day, spread out throughout the day, so there are definitely no duplicate file names. Thanks. itsmarkdavies@hotmail.com
 
Could there be a permissions problem? Does the SQL Agent have permission to write to the destination folder?

I recommend posting questions related to DTS packages and tasks in the new DTS forum. It is forum961. If you want to get the best answer for your question read faq183-874 and faq183-3179.
Terry L. Broadbent - DBA
SQL Server Page:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top