The Palos Publishing Company

Follow Us On The X Platform @PalosPublishing
Categories We Write About

Sort downloads by file type and date

To sort downloads by file type and date, you typically want to organize your files in a way that groups similar file types together and orders them chronologically within those groups. Here’s a straightforward approach you can apply on different platforms or programmatically:

1. Manual Sorting on Your Computer

Windows File Explorer:

  • Open your Downloads folder.

  • Click on the “Type” column header to sort files by their file type (extension).

  • Then, hold Shift and click the “Date modified” column header to sort files by date within each file type group.

macOS Finder:

  • Open your Downloads folder.

  • Switch to List View (Cmd + 2).

  • Click on the “Kind” column header to sort by file type.

  • Then, hold Option and click on Date Modified to sort within each type by date.

2. Using a Script to Sort and Organize Automatically

If you want to automate sorting downloads by file type and date, you can use a script. Here’s an example in Python that sorts files into folders by file type and names them by their modification date:

python
import os import shutil from datetime import datetime download_folder = '/path/to/your/downloads' for filename in os.listdir(download_folder): file_path = os.path.join(download_folder, filename) if os.path.isfile(file_path): file_type = filename.split('.')[-1].lower() mod_time = os.path.getmtime(file_path) date_str = datetime.fromtimestamp(mod_time).strftime('%Y-%m-%d_%H-%M-%S') # Create folder for file type type_folder = os.path.join(download_folder, file_type) if not os.path.exists(type_folder): os.makedirs(type_folder) # Construct new file name with date prefix new_filename = f"{date_str}_{filename}" new_path = os.path.join(type_folder, new_filename) shutil.move(file_path, new_path)

Replace /path/to/your/downloads with your actual downloads folder path.


Would you like me to provide a more detailed guide for a specific platform or a different programming language?

Share this Page your favorite way: Click any app below to share.

Enter your email below to join The Palos Publishing Company Email List

We respect your email privacy

Categories We Write About