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

DTS Import Text file 1

Status
Not open for further replies.

Eyespi20

Technical User
Jan 14, 2004
296
US
I have created a DTS job to import a text file to my server. The file is named based on the date and time it was put in the folder and I've done a dynamic job to cycle through the names to upload all the files.

My question revolves around marking the file as uplodaded once they are done, otherwise I forsee inserting the same record over and over again.

Can I creat a second dynamic job to rename the file?

Thanks

Margaret
 
Hi margaret.

You could use xp_cmdshell at the end of your current DTS to rename the file to a .done (or extension of your choice) and in the beginning when you do the import (or determine files to be imported) add a bit in to say ignore .done files.

Rgds,

M.
 
Another option is to use File System Object (FSO) within an ActiveX script to rename or move the files to a different folder.

This examaple adds a "U" prefix to the file name and keeps it in the same folder:

Code:
Dim fso 
Dim strFile 
Dim strPath 

Set fso = CreateObject("Scripting.FileSystemObject")
strPath = "c:/PathName/"
fso.MoveFile strPath & "File1.txt", strPath & "U" & "File1.txt"
 
Thanks for the suggestions. THis will work great!

Margaret
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top