visualize
❭ utils
❭ find_files_and_order_them
find_files_and_order_them¶
- visualize.utils.find_files_and_order_them(files, files_format='.png')¶
Find files in a list of directories or a directory and order them.
These files are in order, and takes into account if the name of the file is a number (1 would go before 10 even if the number of the file is not 0-padded). If the files param was a list of directories, the files are in order within each directory but the directories order is maintained.
- Parameters:¶
files (list | str) – list of files, list of directories, or a directory.
files_format (str) – format of the files to get (e.g. ‘.png’, ‘.jpg’)
- Returns:¶
List of the files contained in the files argument.
- Return type:¶
list
Example
If files is a list of directories [dir_a, dir_b, dir_c] containing the following files:
Example of directory contents¶ dir_a
dir_b
dir_c
100
world
C
10
30
B
2
5
A
1
hello
70
file
200
9
The result would be: 1, 2, 10, 100, file, 5, 30, 200, hello, world, 9, 70, A, B, C