Unzip Variable - SuccessZipnames

Post variable and regex related tips, questions.

Unzip Variable - SuccessZipnames

Postby Tech Support » Tue Nov 13, 2012 9:50 am

This is a users email support request:

Is there an easy way to:
-uznip files in the directory and delete them in one step
-email name of files that have been unziped

Part of my problem is zip files don't have .zip (or common) extension. They have pdf/doc/xls/etc but they are still compressed -meaning files have extension of the files that are within zip files.
tnx
Tech Support
Site Admin
 
Posts: 1279
Joined: Thu May 25, 2006 11:12 am

Postby Tech Support » Tue Nov 13, 2012 9:51 am

Because you have to unzip to the same filename, you would have to unzip to another folder. This way you have your unzipped files, and can safely delete the original zip. The simplest way would be to use a task sequence task as follows:

1) unzip task
task title = unzip
Source directory = dir containing compressed files
target directory = any other valid folder
filename filter = (leave blank to process all files)

2) taskseq
Step 1 = unzip (select option : go to step email_fail if exit code > 0)
Step 2 = delete
Step 3 = email_success (select option to always stop sequence at this
step, so email_fail is not run)
Step 4 = email_fail

3) delete task
Source directory = dir containing compressed files
Filename field = $%unzip::SuccessZipnames%$

4) email_success
message body:
The following files were unzipped: $%unzip::SuccessZipnames%$
Tech Support
Site Admin
 
Posts: 1279
Joined: Thu May 25, 2006 11:12 am

Postby Tech Support » Wed Nov 14, 2012 8:43 am

User response:

Thank you for the information - very useful. One more question how can separate nicely multiple files using this variable "$%unzip::SuccessZipnames%$" . They appear to be separated only by ^.
Thanks!
Tech Support
Site Admin
 
Posts: 1279
Joined: Thu May 25, 2006 11:12 am

Postby Tech Support » Wed Nov 14, 2012 8:44 am

You could use a Manipulate Variable task before the email tasks. (New
tasks button / Variables folder / Manipulate Variable)

select unzip::SuccessZipnames from the list
find string = ^
replace string = , or ,(space) or two spaces etc...
new variable = unzip::FormattedSuccessZipnames

Then use $%unzip::FormattedSuccessZipnames%$ in your email message body.
Tech Support
Site Admin
 
Posts: 1279
Joined: Thu May 25, 2006 11:12 am


Return to Variables and Regular Expressions

Who is online

Users browsing this forum: No registered users and 1 guest

cron