Move folder action #16337
-
I need to be able to move an asset folder (VolumeFolder) to another folding (in same volume) from a module. Been hacking away and would like to just use the same functionality as the CP uses to do this. Wondering if you can point me in the right direction? The feature request would be that VolumeFolder has a public method exposed to make this easier. Craft 4.9.5, using an S3 filesystem, though I think with the adapter/flysystem that might not be relevant. Many thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Moving folders is potentially an expensive, long-running operation because each contained asset needs to be moved as well. To avoid running into memory/time constraints, assets are each moved from their own Ajax requests. So it wouldn’t be possible for us to contain all that into a single PHP method. That said, you can take a look at |
Beta Was this translation helpful? Give feedback.
Moving folders is potentially an expensive, long-running operation because each contained asset needs to be moved as well. To avoid running into memory/time constraints, assets are each moved from their own Ajax requests. So it wouldn’t be possible for us to contain all that into a single PHP method.
That said, you can take a look at
AssetsController::actionMoveFolder()
to see what happens when you initially choose to move a folder, as well asAssetsController::actionMoveAsset()
to see how to move an individual asset.