689 | def write_list_of_files(file_list, output_file): |
690 | """ |
691 | Save `file_list` list of files into `output_file` text file. |
692 | Args: |
693 | file_list: (list of str) of path to files |
694 | output_file: (str) path to the output txt file |
695 | |
696 | Returns: |
697 | output_file |
698 | """ |
699 | from os.path import isfile |
700 | |
701 | assert isinstance(file_list, list), 'First argument must be a list' |
702 | assert isinstance(output_file, str), 'Second argument must be a str' |
703 | if isfile(output_file): |
704 | return None |
705 | |
706 | text_file = open(output_file, 'w+') |
707 | for created_file in file_list: |
708 | text_file.write(created_file + '\n') |
709 | text_file.close() |
710 | return output_file |