Skip to content

Commit

Permalink
Make sure images have consistent names when generating
Browse files Browse the repository at this point in the history
  • Loading branch information
simonra committed Nov 8, 2018
1 parent deb2b8f commit a825092
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 4 additions & 0 deletions generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ def generate_about_page():
thumbnails = []
if not os.path.isdir('publish/images/thumbnails'):
os.makedirs('publish/images/thumbnails')

from rename_files_in_folder_to_lower_case import rename_files_in_folder_to_lower_case
rename_files_in_folder_to_lower_case('publish/images')

for filename in os.listdir('recipes'):
if filename[0] != '.':
name,extension = filename.split('.')
Expand Down
3 changes: 0 additions & 3 deletions rename_files_in_folder_to_lower_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ def rename_files_in_folder_to_lower_case(directory_path):
raise NotADirectoryError(f'To make sure all files in directory have lowe case names path to valid directory has to be supplied. Got {directory_path}, which does not seem to be an existing directory on your system.')

files = os.listdir(directory_path)
print('files', files)

for file_name in files:
# print('Now working on file:', file)
path_to_current_file = os.path.join(directory_path, file_name)
if os.path.isfile(path_to_current_file):
# print('Is file =D', file)
if file_name != file_name.casefold():
path_to_new_file_name = os.path.join(directory_path, file_name.casefold())
print(f'Renaming {path_to_current_file} to {path_to_new_file_name}')
Expand Down

0 comments on commit a825092

Please sign in to comment.