Unpack multiple files from subfolders and rename

Sharing this script as it may be useful to others.

The purpose is to extract files from a folder directory with multiple subfolders and copy those files to a new folder (without any subfolders). An optional additional process renames all files with an ascending numerical value to a specified file name length (if 3 digits then “001”, “002”, etc.).

Any files which share identical names with files of another format will be given the same numerical name (e.g. “example.rvt” and “example.png” will be renamed to “001.rvt” and “001.png”)

This may be useful when needing to import multiple files into a third program (MAX, blender etc.) as you can select all together. The file rename process is sometimes needed when third-party scripts for batch imports require file names below a certain length.

Dynamo Graph was written in 2.0. Python script for renaming files is from: https://archi-lab.net/printing-pdfs-w-dynamo/

Unpack and Rename Files_v1.dyn (94.7 KB)