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

  • Hello All,

    I have a SSIS package that uses an execute SQL task to locate and configure the package with parameters that are in a SQL table. This execute SQL task gets the folder location and set it as a variable string value "User::FolderLocation". I then use a foreach loop to locate a file name from the folder location. Inside the foreach loop I pass the unzipped file name and folder path to an Execute proceed task to zip the file. This then go on to zip each file in a folder.

    My problem is when I need to zip files where there is space in the folder name. For example:

    If the folder path is:

    "\\NetworkFolder\Address\Misc\Reports Processing\"

    WinZip gives me an error of

    Action: Move

    Include subfolders: yes

    Save full path: no

    no files were found for Zipping that match your selection criteria.

    no files were found for Reports\20130104_Data_Export.ZIP that match your selection criteria.

    Adding 20130104_ADTOLETR_Export.txt

    Total bytes=3003487, Compressed=282076 -> 91 percent savings.

    Replacing old Zip file "\\NetworkFolder\Address\Misc\Reports.zip".

    Moving Files...

    If I remove the space from the folder path for example:

    "\\NetworkFolder\Address\Misc\ReportsProcessing\"

    There isn't an issue and everything is happy.

    Any ideas?

    I have tried "\\NetworkFolder\Address\Misc\Reports+" "+Processing\"

    I have tried "\\NetworkFolder\Address\Misc\Reports+"\"+Processing\"

    I have tried "\\NetworkFolder\Address\Misc\Reports+"/"+Processing\"

    Thanks in advance

    Tim

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

  • Have you added double quotes to the location in your command as well? If you do not have that, winzip will not recognize it as a location.

  • Yes double quotes are used, if you are referring to " rather than '.

    Is this what you mean?

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

  • Sorry the code was

    "\\NetworkFolder\Address\Misc\Reports"+" "+"Processing\"

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

  • You actually need double double quotes 🙂 For example: "\\NetworkFolder\\Address\\Misc\\Reports Processing\\\"".

    See http://www.sqlservercentral.com/Forums/Topic704932-148-1.aspx for the same issue if i am correct.

  • Okay well i removed

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

    and used this example like the post you sent and it did not like it.

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

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

  • Try the following: "-min -m -en \"" + @[User::UnZipFileName] + ".ZIP\" " + @[User::UnZipFileName]

  • I tried that with high hopes but got this message:

    No files were found for this operation - Nothing to do.

    ?\\folder\Folder\TestZipping

    Folder\20130116_data_data_Export.txt.ZIP?.

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

  • I would suggest, if not done yet, testing the correct command on the commandline itself and afterwards making it dynamically within SSIS. And keep in mind that:

    - a backslash is stated as \\.

    - a double quote is stated as \".

    You can then evaluate the expression 🙂

  • Thanks I really appreciate your time and assistance. I will post what works when done. I have searched everywhere and have not found a solution, so thank you very much!

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

  • Anybody else have an thoguths, I am still unable to zip files in a folder location where there is a space in the folder name? I would change the name but this wouls prevent files from getting drop to this loccation from or vendor. Please help.

    Cheers!

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

  • I know this is from left field (and I am not the foremost expert at SSIS) but have you tried the "CHAR" code for a space?

    Something like: "\\NetworkLocation\TopFolder\SubFolder" + CHAR(32) + "RestOfSubFolderName"

  • I am so glad you replied, thank you. So is the CHAR(32) used for one space or for 32 spaces?

    The exact folder name is

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

    So would I code it like this?

    "\\\\phxp-sfs-003\\phxmbumcacrdltr\\TestZipping" + CHAR(1)+ "Folder"

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

  • No the CHAR(32) is for a single space.

    Oops, I should have put an example:

    "\\\\phxp-sfs-003\\phxmbumcacrdltr\\TestZipping" + CHAR(32)+ "Folder"

  • I appreciate the suggestion, but SSIS evaluation states the CHAR is not a recognized function.

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

Viewing 15 posts - 1 through 15 (of 26 total)

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