You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
can a script be used to rename files on upload? #51
I've tried to find documentation on this question, but couldn't find anything. So I want to ask here: Is it possible to use a simple script to rewrite (some) file locations as they get uploaded?
I'm using a google pixel phone with auto-uploading enabled. The camera puts portrait pictures into a subfolder, which makes it quite hard to browse through these pictures in any tool other than the google pictures app. The nextcloud gallery also suffers a lot from this. See e.g.: https://support.google.com/pixelphone/thread/12756704?hl=en
So I'm left with workarounds for this android limitation. Currently, I'm running a manual script to rename these files every now and then and then rescan the whole data folder. I'm hoping that a workflow script could improve this situation somehow?
Expected behaviour
Documentation on whether one can move an input file, or whether this will require a rescan then afterwards?
Actual behaviour
I don't want to experiment with this without any documentation. So I don't know if it actually works or not?
Currently, I'm running a manual script to rename these files every now and then and then rescan the whole data folder. I'm hoping that a workflow script could improve this situation somehow?
You can trigger a wrapper script from this workflow to
call you renamer script
rescan the data folder
It will not be detected as move though, so it appears as a new file. So if an affected picture was shared already, the share would get lost, for instance. The data folder scanning can be narrowed to a specific path.
For a proper rename you would fire a WebDAV move request, utilizing curl for instance. It requires you to have an auth token on the machine though. The advantage is that it goes through all Nextcloud business logic.
P.S.: actions of this flow are not instant, but are executed through a background job.
oh that WebDAV hint sounds interesting - thanks! I'll try to look into this eventually and then report back if I managed to get it done using that.
rescanning the data folder is quite expensive so I'd rather not have to do that every time - esp. if I'd upload N such pictures that need to be renamed, I don't want to trigger N rescans. I believe with the WebDAV move I will be able to prevent that. Cool :)
Consider this a feature request though to be able to do a move from within a workflow easily
Reacted by Arthur Schiwon, EtlamGit and Richard Bos
Activity
blizzz commentedon May 18, 2020
Hi Milian :)
You can trigger a wrapper script from this workflow to
It will not be detected as move though, so it appears as a new file. So if an affected picture was shared already, the share would get lost, for instance. The data folder scanning can be narrowed to a specific path.
For a proper rename you would fire a WebDAV move request, utilizing curl for instance. It requires you to have an auth token on the machine though. The advantage is that it goes through all Nextcloud business logic.
P.S.: actions of this flow are not instant, but are executed through a background job.
milianw commentedon May 18, 2020
oh that WebDAV hint sounds interesting - thanks! I'll try to look into this eventually and then report back if I managed to get it done using that.
rescanning the data folder is quite expensive so I'd rather not have to do that every time - esp. if I'd upload N such pictures that need to be renamed, I don't want to trigger N rescans. I believe with the WebDAV move I will be able to prevent that. Cool :)
Consider this a feature request though to be able to do a move from within a workflow easily
milianw commentedon May 18, 2020
XueSheng-GIT commentedon Aug 18, 2024
Seems there's now also the possibility to use
occ files:moveto rename files. This could be easier than using webdav.