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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copying files accross when updated 1

Status
Not open for further replies.

luzippu

Programmer
Sep 2, 2003
24
GB
hi everyone,

I need to create a ssis in MS SQL Server 2005 that can complete the following:

copy filea.mdb and fileb.mdb (readonly files) from s:\folder1\ to c:\folder1\ on a daily basis (let's say at 07:00am)only when the files dates (modified date) are greater than the equivalent files dates already in the destination folder. (there will always be an older version of the files in the destination folder)
if at 07:00am there aren't any newer files, the copy does not run and somehow i get a confirmation message (netsend, email or log file)

That's all!

Currently i'm using a command file that just copies, but doesn't check the file dates.

I've also tried the 'File Watcher Task' SSIS Control Flow Item, but it failed to work because the .mdb files are set as readonly.

Thanks for your help.
 
hi,

i guess you are using jobs to run these scripts on a tiemly basis?

if yes, then you have to use the Scripting option available in the jobs.

You can write VBScript in Jobs, using VBScript you can do all of the above that you wanted...

Known is handfull, Unknown is worldfull
 
Thanks vbkris.

yes i'm using a job to run this script on a daily basis.

i've found on another post:
Set FSO = CreateObject("scripting.filesystemobject")
FSO.CopyFile "P:\test.txt", "C:\test.txt"

is this the sintax that i should follow?

but i couldn't find much on the "if newfile date > oldfile... then >"

i'm new to vbscript, any idea where i should start from?

thank you
 
hi,

that is just the gist of it. I would suggest looking up on the net for scripting.filesystemobject VBScript code. Plenty of predefined functions are there.

you could use them...

Known is handfull, Unknown is worldfull
 
robocopy would be a great resource here. It will only copy the file if the source is newer. And it returns different return codes depending on if it does work or not.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005) / MCITP Database Administrator (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top