How to print all documents in subfolder after unzipping a file

I’m wondering if anyone has any suggestions on how to print all files within a subfolder? The scenario looks like this:

  1. Receive an email containing a zip file called “Invoices.zip”
  2. Using UiPath’s ‘Extract/Unzip Files’ activity, the robot unzips “Invoices.zip” and extracts the files to a folder:

C:\Users<user name>\Documents\Invoices

  1. I click on Invoices folder and realise there’s a subfolder within called “All Docs”

C:\Users<user name>\Documents\Invoices\All Docs

  1. I click on All Docs and I can see 5 PDF files which I need to print

The objective of the automation is as follows:

  1. Check every new email received and download all attachments to a local folder
  2. If it contains a zip file attachment, robot needs to print all documents contained in that zip file

Would really appreciate it anyone has any suggestions on how to best achieve this functionality! I’m getting stuck as the name of the zip file is dynamic and whether subfolders exist is also changing from email to email

Hi @kerri.tiam2

After step 2, Using UiPath’s ‘Extract/Unzip Files’ activity, you should take advantage of the output DirectoryInfo
image

by adding an assign activity at step 2a
image

and for each loop at step 2b. Inside the Assign of For Each the variable FileFullPath is your extracted PDF file.
image
image

Hi @GreenTea ! Thanks for your advice :slight_smile: I gave it a go but it seems like my output of ‘Extracted contents folder’ is still picking up the main folder instead of the subfolder? I’m wondering if you have any idea what could be causing this issue? I have included screenshots below of my code and the output of ‘Extracted contents folder’ which is showing:

C:\Users\xxxx\Documents\Robots\AP_Print_Email_and_Attachments\Temp\Zip\RM - Voucher Req Forms

The folder where the files are stored in is actually:
C:\Users\xxxx\Documents\Robots\AP_Print_Email_and_Attachments\Temp\Zip\RM - Voucher Req Forms - Inv 126\RM - Voucher Req Forms - Inv 126

Hi @kerri.tiam2

Just Give it a Try
1)


2)

Regards
Sudharsan

1 Like

Thanks @Sudharsan_AIT ! That worked :slight_smile: Not sure why I didn’t check StudioX activities in the first place! Much appreciated!

1 Like

That’s Great @kerri.tiam2

Happy Automation

Regards
Sudharsan

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.