SSIS Package WinZip all Files in a Folder with spaces in the folder path

  • What type of component/operation are you using to generate the variable? Or a better way of stating it might be how is the variable's value established?

  • I am using a foreach loop to locate a each file and passing a fully qualified path and passing it into a string variable called @[User::UnZipFileName] to the execute process task to unzip files.

    The pain of Discipline is far better than the pain of Regret!

  • My reason for the question is to see if you are verifying if you have stripped out any line feeds or carriage returns.

    An example would be: the variable would look like "\\jeff\E$\test folder" but actually it is "\\jeff\E$\test<CR/>folder" which would be interpreted as:

    "\\jeff\E$\test

    folder"

    The for-each loop should allow you to strip things like line feeds and carriage returns off. You should be able to use the REPLACE (SSIS) function (its in the BOL under Replace (SSIS)).

    If not, please respond and I will try another direction.

  • No I do not make any changes to the variable from the foreach loop and when I review the variable in a break task is reads like this

    @[User::UnZipFileName] = {"\\phxp-sfs-003\phxmbumcacrdltr\TestZipping Folder\20130118_Care_Reissue_Export.txt"}

    The pain of Discipline is far better than the pain of Regret!

  • Ok, so its not in the variable creation...

    How is the archiving happening (aka running WinZip)? My guess is that it is using the "Execute Process Task".

    Can you list out how the zip tool is being called and with what variables? I'm trying to repro locally.

  • Sure:

    But if I make s simple change to the folder path, there isn't a problerm.

    Problem

    \\phxp-sfs-003\phxmbumcacrdltr\TestZipping Folder\20130118_Care_Reissue_Export.txt

    NO PROBLEM

    \\phxp-sfs-003\phxmbumcacrdltr\TestZippingFolder\20130118_Care_Reissue_Export.txt

    Here is all the data from the Execute Process Task on the process section

    RequireFullFileNameTrue

    ExecutableC:\Program Files\WinZip\WINZIP32.EXE

    Arguments-min -m -en .ZIP

    WorkingDirectory\\phxp-sfs-003\phxmbumcacrdltr\TestZipping FolderStandardInputVariableUser::UnZipFileName

    StandardOutputVariable

    StandardErrorVariable

    FailTaskIfReturnCodeIsNotSuccessValueTrue

    SuccessValue0

    TimeOut0

    TerminateProcessAfterTimeOutTrue

    WindowStyleNormal

    Expressions are:

    Arguments: "-min -m -en " + @[User::UnZipFileName] + ".ZIP" + @[User::UnZipFileName]

    Which Evaluated is

    -min -m -en \\phxp-sfs-003\phxmbumcacrdltr\TestZipping Folder\20130118_Care_Reissue_Export.txt.ZIP\\phxp-sfs-003\phxmbumcacrdltr\TestZipping Folder\20130118_Care_Reissue_Export.txt

    Working Directory @[User::Path]

    Which Evaluated is

    \\phxp-sfs-003\phxmbumcacrdltr\TestZipping Folder

    Does this help?

    The pain of Discipline is far better than the pain of Regret!

  • Yes it does...

    I believe I have found your problem: In cmd line operations anytime a folder/file name contains spaces you have to wrap the entire item in "s.

    Example: -min -m -en "\\phxp-sfs-003\phxmbumcacrdltr\TestZipping Folder\20130118_Care_Reissue_Export.txt.ZIP" "\\phxp-sfs-003\phxmbumcacrdltr\TestZipping Folder\20130118_Care_Reissue_Export.txt"

    So the next part is how to do this: "-min -m -en " + @[User::UnZipFileName] + ".ZIP" + @[User::UnZipFileName]

    needs to look something like this: "-min -m -en " +""" +@[User::UnZipFileName] + ".ZIP" + "" " + @[User::UnZipFileName] + """

    I hope that helps (I was able to test out my theory in a cmd line but haven't been able to recreate the package).

  • Do you have access to Microsoft Expression Test tool? It can be downloaded at

    http://expressioneditor.codeplex.com/

    But this expression does not evaluate, it geives an error message

    The pain of Discipline is far better than the pain of Regret!

  • @SQLArnold-

    I haven't forgotten about this, I just was wrapped up in "other" work tasks...

    So at first, I was totally perplexed on the command line not testing correctly and then I noticed my error, the line I suggested was syntactically incorrect. Running: C:\.\WinZip\WinZip64.exe -min -m -en "\\testSrv\base\second folder\JeffTest.ZIP" @"\\testSrv\base\second folder\JeffTest.txt" did succeed.

    In any command line syntax now you have to wrap the entire path and the file name in double quotes if a space exists anywhere in the path/file name.

    If I had more time I would have whipped up the correct SSIS steps for doing this, for that I am sorry. I hope this helps.

  • I greatly appreciate your time and no worries I understand being busy. So I want to know that first. I have not tested this but I will reply once I have. I hope you get some time to be not so busy soon.

    Thanks,

    The pain of Discipline is far better than the pain of Regret!

  • @logitestus,

    Due to your help and ideas, we have a solution and here is the winning expression that is working for me.

    "-min -m -en " + "\"" + @[User::UnZipFileName] + ".ZIP \"" + "\"" + @[User::UnZipFileName] + "\""

    Thank you, Thank you, Thank you.

    Tim Harms

    The pain of Discipline is far better than the pain of Regret!

  • Congratulations!

Viewing 12 posts - 16 through 26 (of 26 total)

You must be logged in to reply to this topic. Login to reply