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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 SS 2008 Job Agent
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

8 Posts

Posted - 01/11/2013 :  10:40:43  Show Profile  Reply with Quote
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 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

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 01/11/2013 :  11:16:27  Show Profile  Reply with Quote
see similar implementation here

SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000