Zip multiple files
Overview
The Zip Files function compresses multiple files into a single ZIP archive. This is the most versatile compression operation in Archive Manager Pro, allowing you to bundle multiple files together efficiently.
Function Description
Node Name: Zip Files
Category: Archive Manager
Type: Synchronous (blocking operation)
Compresses multiple specified files and creates a ZIP archive containing all files. The operation completes and returns a boolean indicating success or failure.
Input Parameters
| Parameter | Type | Description | 
|---|---|---|
| Path to Files | Array of Strings | Array containing full absolute paths to all files you want to compress | 
| Path to Zip | String | Full absolute path where the ZIP file should be created | 
| Delete After Compression | Boolean | If true, deletes all original files after successful compression | 
Output Parameters
| Parameter | Type | Description | 
|---|---|---|
| Return Value | Boolean | trueif compression succeeded,falseif it failed | 
Basic Setup Steps
1. Create the File Array
- Add a Make Array node to your Blueprint
- Set the array type to String (file paths)
- Add file path entries:
- Add absolute file paths
- Click Add pin + for additional files
 
2. Add the Zip Files Node
- Right-click in the Event Graph
- Search for “Zip Files”
- Add the Zip Files node from the Archive Manager category
3. Connect the Array
- Connect the Array output from Make Array to Path to Files input
- The purple connection indicates array data type
4. Configure Zip Output
- Path to Zip: Enter the full path for the output ZIP file
- Example: F:\Repos\tests\ArchiveManager\Multiple_files.zip
 
- Example: 
5. Set Compression Options
- Delete After Compression:
- ☑️ Checked: All original files are deleted after successful compression
- ☐ Unchecked: Original files are preserved (recommended for safety)
 
6. Handle the Result
- Connect the Return Value to a Branch node
- True branch: Compression succeeded – add success actions
- False branch: Compression failed – add error handling
7. Add User Feedback
- Connect a Print String node to show operation status
- Example: “Multiple files zipped!” for success
Example Blueprint Setup

Example Array Setup Options
Option 1: Static File List (screenshot above)
Use Make Array with hardcoded file paths – good for known files.
Option 2: Dynamic File Collection
Get Files in Directory
↓ (filter by extension)
Zip Files
Option 3: Variable Array
Get Variable (String Array)
↓
Zip Files
Option 4: User Selection
File Dialog → Selected Files Array
↓
Zip Files
Common Use Cases
- Project backup: Archive multiple project files together
- Asset bundling: Package game assets for distribution
- Document archiving: Compress related documents into single file
- Log collection: Bundle multiple log files for analysis
- User content packaging: Archive user-generated files
Error Handling
If the operation fails, use Get Last Archive Error for specific details:
- One or more files not found
- Insufficient disk space
- Permission denied on source or destination
- Invalid file paths in array
- Destination path not writable
Best Practices
File Management
- Verify all file paths exist before compression
- Use absolute paths to avoid path resolution issues
- Check file permissions on all source files
- Ensure destination directory exists
Array Management
- Remove empty strings from the array
- Validate each path before adding to array
- Handle duplicate paths appropriately
- Sort paths for consistent archive structure
Performance Tips
- Keep arrays reasonably sized (< 1000 files for sync operation)
- Consider async version for large file sets
- Test with small arrays first
- Monitor memory usage with large files
Archive Structure
Files are stored in the ZIP with their original names (without directory structure). For example:
- Input: C:\Folder1\File1.txt,D:\Folder2\File2.txt
- ZIP contains: File1.txt,File2.txt
Performance Notes
File access: All files are read into memory during compression
Synchronous operation: Blocks execution until complete
Memory usage: Scales with total file size
For large file sets: Consider using Zip Files (async) instead
C++ Usage
Basic Implementation (click to expand)
#include "ArchiveManagerBPLibrary.h"
// Multiple files compression
TArray<FString> FilesToCompress;
FilesToCompress.Add(TEXT("C:/MyProject/File1.txt"));
FilesToCompress.Add(TEXT("C:/MyProject/File2.txt"));
FilesToCompress.Add(TEXT("C:/MyProject/File3.txt"));
FString OutputZip = TEXT("C:/MyProject/MultipleFiles.zip");
bool DeleteOriginals = false;
bool Success = UArchiveManagerBPLibrary::ZipFiles(FilesToCompress, OutputZip, DeleteOriginals);
if (Success)
{
    UE_LOG(LogTemp, Log, TEXT("Files compressed successfully: %s"), *OutputZip);
}
else
{
    FString Error = UArchiveManagerBPLibrary::GetLastArchiveError();
    UE_LOG(LogTemp, Error, TEXT("Compression failed: %s"), *Error);
}Advanced file collection
TArray<FString> CollectProjectFiles(const FString& Directory, const FString& Extension)
{
    TArray<FString> FoundFiles;
    TArray<FString> FilePaths;
    
    // Find all files with specific extension
    IFileManager::Get().FindFilesRecursive(FilePaths, *Directory, *(TEXT("*.") + Extension), true, false);
    
    // Validate each file
    for (const FString& FilePath : FilePaths)
    {
        if (FPaths::FileExists(FilePath))
        {
            FoundFiles.Add(FilePath);
        }
    }
    
    return FoundFiles;
}
// Usage
TArray<FString> TextFiles = CollectProjectFiles(FPaths::ProjectContentDir(), TEXT("txt"));
bool Result = UArchiveManagerBPLibrary::ZipFiles(TextFiles, TEXT("C:/Backup/ProjectTexts.zip"), false);Batch processing system
UCLASS(BlueprintType)
class MYGAME_API UFileArchiver : public UObject
{
    GENERATED_BODY()
    
public:
    UFUNCTION(BlueprintCallable, Category = "File Management")
    bool ArchiveDirectory(const FString& SourceDirectory, const FString& OutputZip, bool bRecursive = true)
    {
        TArray<FString> FilesToArchive;
        
        if (bRecursive)
        {
            IFileManager::Get().FindFilesRecursive(FilesToArchive, *SourceDirectory, TEXT("*.*"), true, false);
        }
        else
        {
            IFileManager::Get().FindFiles(FilesToArchive, *SourceDirectory, true, false);
        }
        
        // Filter out directories and invalid files
        FilesToArchive.RemoveAll([](const FString& Path) {
            return !FPaths::FileExists(Path) || FPaths::DirectoryExists(Path);
        });
        
        if (FilesToArchive.Num() == 0)
        {
            UE_LOG(LogTemp, Warning, TEXT("No files found in directory: %s"), *SourceDirectory);
            return false;
        }
        
        UE_LOG(LogTemp, Log, TEXT("Archiving %d files from %s"), FilesToArchive.Num(), *SourceDirectory);
        return UArchiveManagerBPLibrary::ZipFiles(FilesToArchive, OutputZip, false);
    }
    
    UFUNCTION(BlueprintCallable, Category = "File Management")
    bool ArchiveGameLogs()
    {
        TArray<FString> LogFiles = CollectProjectFiles(FPaths::ProjectLogDir(), TEXT("log"));
        FString ZipPath = FPaths::ProjectSavedDir() / TEXT("LogBackup_") + FDateTime::Now().ToString() + TEXT(".zip");
        
        return UArchiveManagerBPLibrary::ZipFiles(LogFiles, ZipPath, false);
    }
};