Synchronize assets between filesystems in Craft CMS, allowing you to migrate from local storage to cloud storage (e.g., Cloudflare R2) while preserving all asset metadata and database references.
- Sync assets from one filesystem to another
- Preserves all asset metadata (IDs, titles, alt text, custom fields, etc.)
- Progress tracking with visual feedback
- Dry-run mode for testing
- Error handling and reporting
- Resume capability (skips already-copied files)
The plugin is located in plugins/flowsa/asset-sync/ and will be automatically loaded by Craft CMS.
ddev craft asset-sync/sync --volume=<volume-handle> --destination-filesystem=<filesystem-handle>--volume(required): The handle of the asset volume to sync--destination-filesystem(required): The handle of the target filesystem--dry-run: Test mode - shows what would be copied without actually copying--force: Skip confirmation prompt
# Preview what will be synced
ddev craft asset-sync/sync --volume=files --destination-filesystem=cloudFiles --dry-run
# Execute the sync
ddev craft asset-sync/sync --volume=files --destination-filesystem=cloudFiles
# Execute without confirmation prompt
ddev craft asset-sync/sync --volume=files --destination-filesystem=cloudFiles --force-
Ensure R2 filesystem is configured
- Verify R2 credentials in
.env - Check filesystem config in
config/project/project.yaml
- Verify R2 credentials in
-
Run dry-run to preview
ddev craft asset-sync/sync --volume=files --destination-filesystem=cloudFiles --dry-run
-
Execute the sync
ddev craft asset-sync/sync --volume=files --destination-filesystem=cloudFiles
-
Update volume configuration
- Edit
config/project/volumes/<volume-uid>.yaml - Change
fs: filestofs: cloudFiles
- Edit
-
Apply project config
ddev craft project-config/apply
-
Verify assets are accessible
- Check asset URLs in control panel
- Test image transforms
- Verify file downloads
-
Keep local files as backup until fully verified
- All asset files from the source filesystem
- Directory structure is preserved
- File paths remain identical
- Asset IDs remain the same
- Database records are unchanged
- Asset metadata (alt text, focal points, custom fields) is preserved
- Asset URLs update automatically after volume filesystem change
The sync automatically skips files that already exist in the destination filesystem, allowing you to resume an interrupted sync or re-run the command safely.
- Check that the volume handle is correct using:
ddev craft volumes
- Check available filesystems in
config/project/project.yamlunder thefs:section
- Verify R2 credentials are correct
- Check filesystem URL configuration
- Ensure bucket permissions are set correctly
For issues or questions, contact Flow Communications at http://www.flowsa.com