Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 SS 2008 Job Agent

Author  Topic 

themar42
Starting Member

8 Posts

Posted - 2013-01-11 : 10:40:43
Created step in job using vbscript, the step is supposed to copy and move a file to a directory only if the file is a certain size. When I check the job history, it says that "The step did not generate any output. The step succeeded". My problem is that when I go to check the directory the file should have been moved and copied to, the file is not there. I only want the file moved if it contains data, that's why I have the size method in there. See script below:


SET filesys=CreateObject("Scripting.FileSystemObject")

DIM dDATE
DIM Filesys
dDATE = DateSerial(Year(Now()), Month(Now()), Day(Now()))

valYear = CStr(Year(dDATE))
valMonth = CStr(Month(dDATE))
valDay = CStr(Day(dDATE))

If len(valMonth) = 1 Then
valMonth = "0" & valMonth
End If

If len(valDay) = 1 Then
valDay = "0" & valDay
End If







If filesys.FileExists("\\server123\folder\folder\file.xls") and filesys.size > 14336 Then
filesys.CopyFile \\server123\folder\folder\file.xls", "\\server123\folder\folder\folder1\file.xls_" & valYear & valMonth & valDay & ".xls"
End If

SET filesys = Nothing

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-01-11 : 11:16:27
see similar implementation here

http://visakhm.blogspot.in/2012/12/selective-file-archiving-using-ssis.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -