collect_preview#

Collect all the tif files under preview folder into the main folder. Assume file structure is shown below. All the tif files are put in folder “collect preview”.

main_folder
|-- parent1
    |-- preview
        |-- 0.tif
        |-- 1.tif
        |-- ...
|-- parent2
    |-- preview
        |-- 0.tif
        |-- 1.tif
        |-- ..
|-- collect_preview
    |-- parent1-0.tif
    |-- parent1-1.tif
    |-- parent2-0.tif
    |-- parent2-1.tif

Syntax

python collect_preview main_folder
  • main_folder: the folder that contains subfolders named “preview”.

Note

  • preview folder need not be immediate subfolder of main_folder.

Test

python collect_preview.py test_images\gen_preview

Edit

  • Dec 06, 2022 – Initial commit.

  • Feb 08, 2023 – Rewrite in function wrapper form, to make autodoc work properly. (autodoc import the script and execute it, so anything outside if __name__=="__main__" will be executed, causing problems)