TAAFT
Free mode
100% free
Freemium
Free Trial
Deals
Create tool

mr crabs is awesome

@mrcrabsisawesom Tasks: 40
๐Ÿ› ๏ธ 1 tool ๐Ÿ™ 87 karma
Enthusiast
Joined: September 2024

mr crabs is awesome's tools

  • Hackts
    Your AI companion for coding and tech innovation
    Open
    391
    16
    5.0
    85
    Released 1y ago
    100% Free
    Sure! Below is a Python script that automates file organization in your Downloads folder. The script categorizes files into subfolders based on their file extensions. For example, it will create folders for documents, images, audio, and video files. ```python import os import shutil # Define the path to the Downloads folder downloads_folder = os.path.expanduser("~/Downloads") # Define the file categories and their corresponding extensions file_categories = { 'Documents': ['.pdf', '.docx', '.doc', '.txt', '.pptx', '.ppt'], 'Images': ['.jpg', '.jpeg', '.png', '.gif', '.bmp'], 'Audio': ['.mp3', '.wav', '.aac', '.flac'], 'Video': ['.mp4', '.mov', '.avi', '.mkv'], 'Others': [] } # Create subfolders if they don't exist for category in file_categories.keys(): category_path = os.path.join(downloads_folder, category) if not os.path.exists(category_path): os.makedirs(category_path) # Organize files for filename in os.listdir(downloads_folder): file_path = os.path.join(downloads_folder, filename) # Skip if it's a directory if os.path.isdir(file_path): continue # Get file extension file_extension = os.path.splitext(filename)[1].lower() moved = False # Move file to the corresponding category folder for category, extensions in file_categories.items(): if file_extension in extensions: shutil.move(file_path, os.path.join(downloads_folder, category, filename)) moved = True break # If the file extension is not recognized, move it to 'Others' folder if not moved: shutil.move(file_path, os.path.join(downloads_folder, 'Others', filename)) print("Files have been organized!") ``` ### Instructions to Use the Script: 1. Install Python if you haven't already. 2. Save the code above in a file, e.g., `organize_downloads.py`. 3. Run the script using the command line: ``` python organize_downloads.py ``` This script will organize all the files in your Downloads folder by moving them into their respective folders. You can modify the `file_categories` variable to add or change categories and extensions as needed. Make sure to back up important files before running the script for the first time!
0 AIs selected
Clear selection
#
Name
Task