Pick files from multiple folders & compress into a zip file using PowerShell alternative replacement

Hey Guys! Managing files across multiple folders can be a challenge, especially when you need to pick specific file types and compress them into a ZIP file. This guide will walk you through how to achieve this using both Copywhiz and PowerShell.

Let’s take a look on how to achieve this using Copywhiz:

What is Copywhiz?

Copywhiz enhances your file-copy experience by letting you to have more flexibility & control over the file copying and backup process.

Here is how Copywhiz makes file copying a breeze:

  • Copy only new or modified files
  • Easily pick files by name, extension, folder etc from bunch of folders
  • Automatically organize files based on file attributes and metadata
  • Copy files to multiple folders/computers
  • Copy files from multiple folders and paste them at once
  • Sync files between source and destination
  • Pick files from multiple folders and compress in single .zip file
  • Schedule file backups
  • Verify copied files for data integrity
  • Retain security attributes of files & folders (ownership/user access)
  • Several more hidden nuggets designed to make your file-copy task easier.

Here is a video describing this feature:

Video Transcription:

  1. As we see in the video, we are copying various files from different folders.
  2. Right-click and add it to Copywhiz.
  3. Go to the destination folder, right-click and choose Copywhiz Paste Special.
  4. Under Paste special we can see Paste as compressed zip file.
  5. Specify the name and paste now.

Using PowerShell:

Step 1: Open PowerShell

  1. Press Win + X and select Windows Terminal (Admin) or PowerShell (Admin).
  2. Navigate to the directory where you want to create the ZIP file using:cd "C:\Users\YourUser\Documents"

Step 2: Select and Compress Files

Use the following PowerShell command to pick files of different types from multiple folders and compress them:

$sourceFolders = @("C:\Folder1", "C:\Folder2", "C:\Folder3")
$destinationZip = "C:\Users\YourUser\Documents\SelectedFiles.zip"
$fileTypes = "*.txt", "*.jpg", "*.pdf"

# Create a temporary folder
$tempFolder = "C:\TempSelectedFiles"
New-Item -ItemType Directory -Path $tempFolder -Force

# Copy matching files to temporary folder
foreach ($folder in $sourceFolders) {
    foreach ($type in $fileTypes) {
        Copy-Item -Path (Join-Path -Path $folder -ChildPath $type) -Destination $tempFolder -Force -ErrorAction SilentlyContinue
    }
}

# Create ZIP file
Compress-Archive -Path "$tempFolder\*" -DestinationPath $destinationZip -Force

# Remove temporary folder
Remove-Item -Path $tempFolder -Recurse -Force

Write-Output "ZIP file created successfully at $destinationZip"

Explanation:

  • The script selects files from multiple source folders.
  • It filters files by extension (*.txt, *.jpg, *.pdf, etc.).
  • The selected files are copied to a temporary folder.
  • Compress-Archive creates the ZIP file.
  • The temporary folder is deleted after compression.

Conclusion

Copywhiz provides simplicity and convenience for everyday tasks.

Learn more about Copywhiz. Download the free trial from here.

For short tutorial videos, Check out this page.

Subscribe to our YouTube channel for interesting videos.

Check out our other cool products.

Have a good day!

Thanks :)

Leave a Reply

Your email address will not be published. Required fields are marked *