dbTalk Databases Forums  

DTS VB Script question

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss DTS VB Script question in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Matt L
 
Posts: n/a

Default DTS VB Script question - 08-20-2003 , 09:50 AM






I am trying to in activex script when looping through a directory if I
come across a file that isnt equal to my .dbf I move the file to an
archive directory. Not only must it not be a dbf file but it cant be
a dbf filename that ends in i.dbf and d.dbf.

gv_fileFullName = "c:\server\transfer\onei.dbf
gv_FileExtension = "dbf"

I strip off the last character before the extension as is it is import
for processing file.

Following IF is all on one line

if DTSGlobalVariables("gv_FileExtension").Value = "dbf" and
(StripOffFilePart( DTSGlobalVariables("gv_FileFullName").Value,".") <>
"i.dbf" or StripOffFilePart(
DTSGlobalVariables("gv_FileFullName").Value,".") <> "d.dbf") Then

Does anyone know the correct way in VB script to accomplish this?

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: DTS VB Script question - 08-21-2003 , 01:19 AM






Personally I use

GetExtensionName for finding extensions

And I would do a right(filename,4) for the i.dbf

For Each File in Fold.Files
if fso.GetExtensionName(fil) <> "dbf" OR Right(fil.name,4) <> "i.dbf"
THEN
yadda yadda
End if
Next

Untested

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"Matt L" <mattclarson (AT) hotmail (DOT) com> wrote

Quote:
I am trying to in activex script when looping through a directory if I
come across a file that isnt equal to my .dbf I move the file to an
archive directory. Not only must it not be a dbf file but it cant be
a dbf filename that ends in i.dbf and d.dbf.

gv_fileFullName = "c:\server\transfer\onei.dbf
gv_FileExtension = "dbf"

I strip off the last character before the extension as is it is import
for processing file.

Following IF is all on one line

if DTSGlobalVariables("gv_FileExtension").Value = "dbf" and
(StripOffFilePart( DTSGlobalVariables("gv_FileFullName").Value,".")
"i.dbf" or StripOffFilePart(
DTSGlobalVariables("gv_FileFullName").Value,".") <> "d.dbf") Then

Does anyone know the correct way in VB script to accomplish this?



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.