Python or workflow to batch run multiple regex substitutions on multiple files
robopu last edited by
the title says it all.
i basically have a bunch of text files with a given extension in editorial (and or via dropbox). i would love to be able to batch process a bunch of these files by triggering a single workflow and or pythonista script. the subset of files could be
- all the files in a given folder,
- all the files in a given folder and any child folders
- a list of selected files
but i'm not sure how to prompt to select files or folder(s) or specify some "current" folder in editorial workflow / triggered pythonista script.
after i get the list, i'm not sure how to specify and then carry out 1 or more regex substitutions on each file in the list
finally, i need to save changes to the original file and or a backup of it with some change in the filename.
can anybody point me to a similar script or workflow that allows for specifying / selecting multiple file(s) / folder(s) and or applying multiple regexs to them? i'm having trouble finding something similar to the functionality for either of those tasks in either the forums or existing workflows. not asking people to do the work for me unless something is indeed already out there. i just need a pointer to something to get started as these seem like very common tasks related to working with batches of files. i can already do this using batch processing in vim but i want to find a way to do it within editorial.
thanks in advance