My script is going to system to download files which will be zip. After that i have to unzip it and move it to desired folder. My query here is after unzipping i want to only take relevant files n deletd the zip and rest files. I only need .xlsx files only. What is the workflow for this? Which is the efficient way of doing it?
You can handle this cleanly and efficiently in UiPath using below structured approach.
Step 1: Unzip the file
Use “Extract/Unzip Files” activity and extract to a temporary folder (for example: Temp_Unzip_Folder).
Step 2: Get only .xlsx files
Use “For Each File in Folder” activity.
Folder path → Temp_Unzip_Folder
Filter → *.xlsx
This ensures only Excel files are picked. No need to manually check extensions.
Step 3: Move required files
Inside the loop use “Move File” activity:
From → CurrentFile.FullName
To → Path.Combine(“DesiredFolderPath”, CurrentFile.Name)
Step 4: Delete unwanted files
Since you filtered only *.xlsx, other files will remain in Temp_Unzip_Folder.
After moving Excel files, use “Delete Folder” on Temp_Unzip_Folder.
This removes remaining unwanted files in one go.
Step 5: Delete original zip
Use “Delete File” on the downloaded zip file path.
Efficient Flow Summary:
Download → Unzip to Temp → Move *.xlsx only → Delete Temp Folder → Delete Zip
Kindly refer below post, it should give you a good idea on your workflow. In the loop, have a if condition to check if file is .xlsx, if yes do the steps you need for xlsx files and under else, include the delete file activity. This will delete all the files that ae not .xlsx from the folder and also perfom the steps you include on .xlsx files.