May 24, 2005 at 9:07 am
I need to do the following steps as a DTS Package:
1). read files from a specific location on a specific machine.
2). import those records into a staging db.
3). copy inserts/updates into a live db.
4). create a datetime-stamped directory on the machine to move the source files into (I will need to read the datetime from a column in the source file).
5). schedule the whole thing to run once a day (new source files are placed in the source directory every day).
I am perfectly okay with Tasks 1-3 & 5, however I have no idea how to do 4). - can anyone help?
Kind regards,
Jon
May 24, 2005 at 9:15 am
Something like this should give you some ideas.
Dim oFso, oFolder, cNewName
Set oFso = CreateObject("Scripting.FileSystemObject")
Set oFolder = ofso.GetFolder("C:\Inetpub\wwwroot\Development\ppnet\")
cNewName = Replace(CDate(Date),"/","") + Replace(Time,":","")
oFolder.Name = cNewName
oFolder = Null
oFso = Null
DTSGlobalVariables("Backup Folder").Value = cNewName
I am certainly not an expert on VBScript but it seems to work ok.
I hope it gives you some pointers.
May 25, 2005 at 6:09 am
Best way is to use mkdir command
exec master.dbo.xp_cmdshell 'mkdir "c:\temp\foldername\"'
This code goes into a normal sql statement. Just select the foldername from your table into a variable and replace 'foldername' with the name of that variable.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply