Issue with Target Variable for enumerated file list

90 views
Skip to first unread message

Ms. E

unread,
Oct 20, 2009, 10:12:04 PM10/20/09
to CozyRoc
I am trying to use the zip task within a foreach loop but I'm having
difficulty. The foreach loop points to a series of gzip files. Each
file's path and name is passed into a source variable. I've validated
that the source variable is populating correctly. I'm having problems
with the target variable. What is this property? Is it the path name
or an actual file name? I tried using a variable set to "c:
\ftpdirectory" but keep getting an 'Invalid Target' error. When I use
a file connection I get an access denied to the corresponding folder.
I am using Compression Type = File.
What am I doing wrong? What I'm trying to accomplish is for each .gz
file that is contained within a directory, I want to extract it.

Thanks to anyone for their help.

Ivan Peev

unread,
Oct 20, 2009, 10:19:19 PM10/20/09
to CozyRoc
Hi Ms.E

The target parameter has to point to actual file name, not a folder.
This is required only for CompressionType=File. All other types expect
folder as a target parameter.

Regards,
Ivan

Ms. E

unread,
Oct 20, 2009, 11:03:15 PM10/20/09
to CozyRoc
Ivan thanks for responding. In my case I have roughly 20 gzip files
in this directory. I can't specify just one file name to extract to.
I changed to TAR and maintained the mapping to the directory and for
each file I received a Task Failed Zip Task error for each iteration.
Is it even possible to extract files using a loop?

Thanks again.

Ivan Peev

unread,
Oct 20, 2009, 11:42:18 PM10/20/09
to CozyRoc
Yes, it is possible. You have to use CompressionType=File. For the
target parameter you have to create an expression, which dynamically
builds extracted file name from the source parameter file name. So
let's say you want to extract a source file:

c:\ftpdirectory\file1.txt.gz

You have to make an expression, which sets the target parameter to:

c:\ftpdirectory\file1.txt

Erica M. Baity

unread,
Oct 20, 2009, 11:59:04 PM10/20/09
to coz...@googlegroups.com
Ivan, does this file need to already exist?  Here are my settings:

IsTargetVariable = False
Target = File Connection named Zip Target
OverwriteExisting = True

I have an expression set on the Zip Task which sets the Target name to the following: SUBSTRING( @[User::varFTPFileName],1, LEN(@[User::varFTPFileName])-3).  This gives me a file with .log extension.

I'm still getting an error saying the connection is not found. I can't use a variable because when the expression is evaluated it takes on a string value.  Thanks for your help!

Ivan Peev

unread,
Oct 21, 2009, 12:04:11 AM10/21/09
to CozyRoc
Erica,

You can use either file connection manager or variable. When you use
variable you have to set EvaluateAsExpression=TRUE property on the
variable and then setup your variable expression. For the connection
manager you have to setup the expression in the connection manager,
not in the Zip Task. My guess is that right now you are dynamically
modifying the target parameter to non-existent file connection
manager.

On Oct 20, 11:59 pm, "Erica M. Baity" <ericalmil...@gmail.com> wrote:
> Ivan, does this file need to already exist?  Here are my settings:
>
> IsTargetVariable = False
> Target = File Connection named Zip Target
> OverwriteExisting = True
>
> I have an expression set on the Zip Task which sets the Target name to the
> following: SUBSTRING( @[User::varFTPFileName],1,
> LEN(@[User::varFTPFileName])-3).  This gives me a file with .log extension.
>
> I'm still getting an error saying the connection is not found. I can't use a
> variable because when the expression is evaluated it takes on a string
> value.  Thanks for your help!
>

Erica M. Baity

unread,
Oct 21, 2009, 12:16:00 AM10/21/09
to coz...@googlegroups.com
Thanks Ivan. I was successful setting the expression on the connection manager.
Reply all
Reply to author
Forward
0 new messages