Up: Component summary Component

FolderCleaner

Renames a folder of files, by leaving only the last extension. For arrays, the key names are renamed.

Example: image.TIF.png.jpg is renamed to image.jpg

Version 1.2
Bundle tools
Categories Reporting
Authors Ville Rantanen (ville.rantanen@helsinki.fi)
Issue tracker View/Report issues
Requires Python
Source files component.xml extclean.py
Usage Example with default values

Inputs

Name Type Mandatory Description
in BinaryFolder Optional Source folder.
inArray Array<BinaryFolder> Optional Source array.

Outputs

Name Type Description
out BinaryFolder Target folder.
outArray Array<BinaryFolder> Target array.

Parameters

Name Type Default Description
extensions string "csv,txt,xls,xml,bmp,gif,jpg,jpeg,tif,tiff,png,pdf,svg" Comma separated case insensitive list of valid extensions to remove.
filePattern string ".*" Regular expression that must match the file names for copying. Matching happens before extension rename.
link boolean false Create symbolic links instead of copying files
preprocess string "" A Python script which is executed at the beginning. All the variables and libraries defined in this script can be used later.
remove string "False" A Python script snippet to decide if the file should be removed. If the snippet returns True, the file is removed from output. With the default value nothing is removed. Note that the new_index variable has the value for the index that the element would have if it is not removed. Use variables inPath (full path) and inName (basename) to remove files.
rename string "name" Python expression to rename file names. e.g. re.sub("foo$","bar",name), or name.replace("foo","bar")

Test cases

Test case Parameters IN
in
IN
inArray
OUT
out
OUT
outArray
case1 properties in inArray (missing) (missing)

case2_remove properties in (missing) out (missing)

remove=os.path.getsize(inPath)==0 or sum([1 for line in open(inPath)])<5


Generated 2019-02-08 07:42:16 by Anduril 2.0.0