This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
start:knowledge:computer_science:programming [2025/03/12 12:13] – removed - external edit (Unknown date) 127.0.0.1 | start:knowledge:computer_science:programming [2025/03/24 09:57] (current) – [Copy all images from folder and child folders] florian | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | [[start: | ||
+ | ====== Programming ====== | ||
+ | ===== Background ===== | ||
+ | |||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | |||
+ | |||
+ | ===== Languages ===== | ||
+ | |||
+ | ==== Artistic Languages ==== | ||
+ | [[https:// | ||
+ | Processing\\ | ||
+ | |||
+ | ==== C++ ==== | ||
+ | |||
+ | [[https:// | ||
+ | [[https:// | ||
+ | |||
+ | |||
+ | ==== Lua ==== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | ==== Pyhon ==== | ||
+ | |||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | |||
+ | === Copy all images from folder and child folders === | ||
+ | |||
+ | <code Python [enable_line_numbers=" | ||
+ | import os | ||
+ | import shutil | ||
+ | def copy_images_and_parent_folder(source_folder, | ||
+ | # Create the destination folder if it doesn' | ||
+ | if not os.path.exists(destination_folder): | ||
+ | os.makedirs(destination_folder) | ||
+ | # Walk through the source folder and its subfolders | ||
+ | for root, dirs, files in os.walk(source_folder): | ||
+ | for file in files: | ||
+ | # Check if the file is an image (based on file extension) | ||
+ | if file.lower().endswith((' | ||
+ | source_path = os.path.join(root, | ||
+ | destination_path = os.path.join(destination_folder, | ||
+ | shutil.copy2(source_path, | ||
+ | print(f" | ||
+ | # Copy the parent folder from the source to the destination | ||
+ | parent_folder = os.path.dirname(source_folder) | ||
+ | parent_folder_name = os.path.basename(parent_folder) | ||
+ | destination_parent_folder = os.path.join(destination_folder, | ||
+ | if not os.path.exists(destination_parent_folder): | ||
+ | shutil.copytree(parent_folder, | ||
+ | print(f" | ||
+ | # Set the source folder path (change to the desired folder) | ||
+ | source_folder_path = "/ | ||
+ | # Set the destination folder path (create a new folder or use an existing one) | ||
+ | destination_folder_path = "/ | ||
+ | # Call the function to copy images and the parent folder | ||
+ | copy_images_and_parent_folder(source_folder_path, | ||
+ | }(); | ||
+ | </ | ||
+ | |||
+ | Replace "/ | ||
+ | |||
+ | |||
+ | ===== Git ===== | ||
+ | |||
+ | |||
+ | [[https:// | ||
+ | [[https:// |