I am currently working on a workflow that downloads a file from ArcGIS Online and I am then uploading the attachment to Cityworks via the API. The file is downloaded with a general name and I'd like to change the name of the file before passing to the API. I have done some digging on this forum and I am not seeing a way to dynamically change the file name based on other attributes in the middle of a workflow. Would I have to build a custom transformer to do this? Any ideas or examples appreciated, thanks!
Page 1 / 1
Hi @shomber2 ,
A few ways come to mind when manipulating files. If you have the filename in an attribute within your workflow, you could use a Filecopy FeatureWriter with the "Move" setting by providing it with the full path. Another option would be to use a PythonCaller or even the SystemCaller.
Here is a post going over some of these options.
Is there a quick way to rename files? (safe.com)
Python File Operations
os — Miscellaneous operating system interfaces — Python 3.11.2 documentation
shutil — High-level file operations — Python 3.11.2 documentation
Hi,
Thanks for the quick reply!
I was able to achieve the result I was looking for using PythonCaller. Below is a screenshot of the code if anyone else comes across this.