PHPackages                             webium/silverstripe-assets-sync - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. webium/silverstripe-assets-sync

ActiveSilverstripe-vendormodule

webium/silverstripe-assets-sync
===============================

A SilverStripe module for importing files from a directory into the Assets system

1.0.1(6mo ago)11BSD-3-ClausePHPPHP ^7.4 || ^8.0

Since Oct 21Pushed 6mo agoCompare

[ Source](https://github.com/hubertusanton/silverstripe-assets-sync)[ Packagist](https://packagist.org/packages/webium/silverstripe-assets-sync)[ RSS](/packages/webium-silverstripe-assets-sync/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

SilverStripe Assets Sync
========================

[](#silverstripe-assets-sync)

A SilverStripe module for importing files from a directory into the Assets system. This module provides a BuildTask that recursively scans a specified directory and imports all files into the SilverStripe database, maintaining the folder structure.

Features
--------

[](#features)

- **Recursive Import**: Automatically imports all files from subdirectories
- **Folder Structure Preservation**: Maintains the original directory structure in SilverStripe Assets
- **Duplicate Prevention**: Skips files that already exist in the target folder
- **Auto-Publishing**: Automatically publishes imported files
- **Configurable Source Directory**: Easily configure which directory to import from
- **Progress Reporting**: Clear feedback on import status, successes, and errors

Installation
------------

[](#installation)

```
composer require webium/silverstripe-assets-sync
```

After installation, run:

```
vendor/bin/sake dev/build flush=1
```

Or with DDEV:

```
ddev sake dev/build flush=1
```

Usage
-----

[](#usage)

### 1. Create the Import Directory

[](#1-create-the-import-directory)

By default, the module looks for files in `public/assets/import/`. Create this directory:

```
mkdir -p public/assets/import
```

### 2. Add Files to Import

[](#2-add-files-to-import)

Place the files you want to import in the `public/assets/import/` directory. You can organize them in subdirectories:

```
public/assets/import/
├── document1.pdf
├── image1.jpg
├── subfolder1/
│   ├── document2.pdf
│   └── image2.jpg
└── subfolder2/
    └── document3.pdf

```

### 3. Run the Import Task

[](#3-run-the-import-task)

Execute the import task via command line:

```
vendor/bin/sake dev/tasks/ImportFilesFromDirectoryTask flush=1
```

**With DDEV:**

```
ddev sake dev/tasks/ImportFilesFromDirectoryTask flush=1
```

### 4. View Results

[](#4-view-results)

The task will output:

- ✓ Successfully imported files with their database IDs
- ⚠ Skipped files that already exist
- ✗ Errors encountered during import
- Summary statistics at the end

Example output:

```
=== Import Files from Directory Task ===
Importing from: /path/to/public/assets/import
Target folder in Assets: import

✓ Target folder ready (ID: 123)

Found 5 file(s) to import

✓ IMPORTED: import/document1.pdf (ID: 124)
✓ IMPORTED: import/image1.jpg (ID: 125)
✓ IMPORTED: import/subfolder1/document2.pdf (ID: 126)
⚠ SKIPPED: image1.jpg (already exists in import with ID: 125)
✓ IMPORTED: import/subfolder2/document3.pdf (ID: 127)

=== Import Complete ===
Successfully imported: 4
Errors: 0
Skipped (already exists): 1

```

Configuration
-------------

[](#configuration)

You can configure the import directory by creating a YAML config file in your project:

**app/\_config/assets-sync.yml:**

```
---
Name: my-assets-sync-config
After: webium-assets-sync
---
Webium\AssetsSync\Task\ImportFilesFromDirectoryTask:
  import_directory: 'my-custom-import-folder'
```

This will change the import source from `public/assets/import/` to `public/assets/my-custom-import-folder/`.

How It Works
------------

[](#how-it-works)

1. **Directory Scanning**: The task recursively scans the configured directory for all files
2. **Folder Creation**: Creates corresponding folders in the SilverStripe Assets system if they don't exist
3. **File Import**: For each file:
    - Checks if it already exists in the target folder
    - If it exists, skips it
    - If it's new, creates a new `File` object
    - Sets the file content using `setFromLocalFile()`
    - Assigns it to the correct parent folder
    - Writes it to the database
    - Publishes it
4. **Reporting**: Outputs the status of each file and final statistics

Requirements
------------

[](#requirements)

- PHP 7.4+ or 8.0+
- SilverStripe Framework ^4.0 or ^5.0
- SilverStripe Assets ^1.0 or ^2.0

Use Cases
---------

[](#use-cases)

This module is particularly useful for:

- **Bulk Migration**: Moving large numbers of files from a file system into SilverStripe
- **Initial Setup**: Importing existing assets when setting up a new SilverStripe site
- **Content Sync**: Periodically syncing files from an external source
- **Development**: Quickly populating a development environment with assets

Author
------

[](#author)

**Bart van Irsel**Webium Email:

License
-------

[](#license)

BSD-3-Clause

Support
-------

[](#support)

For issues and feature requests, please contact Webium or the module maintainer.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance66

Regular maintenance activity

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

209d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/620a71b0219e7a3b9cec3626c6b023c9f4fa6b2c142a183887c343bf4d7ee195?d=identicon)[hubertusanton](/maintainers/hubertusanton)

---

Top Contributors

[![hubertusanton](https://avatars.githubusercontent.com/u/582188?v=4)](https://github.com/hubertusanton "hubertusanton (5 commits)")

---

Tags

silverstripefilesimportassetssync

### Embed Badge

![Health badge](/badges/webium-silverstripe-assets-sync/health.svg)

```
[![Health](https://phpackages.com/badges/webium-silverstripe-assets-sync/health.svg)](https://phpackages.com/packages/webium-silverstripe-assets-sync)
```

###  Alternatives

[unclecheese/silverstripe-kickassets

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

4728.3k1](/packages/unclecheese-silverstripe-kickassets)[silverstripe/secureassets

Adds access restrictions to folders in assets, similar to the way you secure pages

17157.0k5](/packages/silverstripe-secureassets)[unclecheese/kickassets

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

464.0k](/packages/unclecheese-kickassets)[unclecheese/dropzone

An HTML5 upload field for the CMS and frontend forms.

46130.7k6](/packages/unclecheese-dropzone)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
