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 2000 Forums
 Import/Export (DTS) and Replication (2000)
 how to handle zero byte files?

Author  Topic 

yipchunyu
Yak Posting Veteran

80 Posts

Posted - 2006-10-03 : 22:32:44
I have a DTS program that import some text files to my system daily. However, recently, we found that some files may be 0 bytes in some special condition (no data need to import at all).

We don't know how to handel this (whether count it as a success taskes/completed tasks or others) as it stops the flow of DTS imports of other tasks.
any help?

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-10-03 : 23:39:46
Can you just delete the zero-byte files? If so, add the following as an Execute Process task:

for %a in (myFolder\myFiles*.*) do if %~za==0 del %a

This uses the command-line for command to enumerate the files in myFolder and check the file size. If it is zero it will delete the file. Change your folder and file mask to match the path you're using in your DTS package. This task should be the first step in the execution line.
Go to Top of Page
   

- Advertisement -