autoMate.py - haltosan/RA-python-tools GitHub Wiki

Automation Library

The idea behind this is to help automate the boring stuff (copying files, renaming, etc.). Everyone should feel free to contribute (please do) so we have tools to speed up the manual portions of our projects.

Functions

Syntax

fname(file: str) -> str

Returns the file name ('bucket.jpg') from a path string ('/images/bucket.jpg')


ffolder(file: str) -> str

Returns the file's folder ('/this/is/a/') from a path string ('/this/is/a/bucket.jpg')


bulkcopy(files: list, destFolder: str)

Copies files from a given path string list (['/images/bucket.jpg', '/sounds/no.mp3', '/soldier.py']) to a destination folder ('/newFolder/')


rename(files: list, destFolder: str, renameFunction)

Renames files as these files are moved to a destination folder. Follow the same rules for files and destFolder. renameFunction should follow function(filePath: str) -> str where filePath is a file path supplied from files. The return value will become the new file name ('/destFolder/f(name)').