Skip to content

OSError [WinError 123] when organizing by size on Windows due to invalid folder names. #5

@LeonardoLBraga

Description

@LeonardoLBraga

Describe the bug
When running the script on Windows and choosing to organize files by size, the program tries to create folders with names containing invalid characters (like < and >), causing an OSError: [WinError 123] because Windows does not allow those characters in folder names.

To Reproduce
Steps to reproduce the behavior:

  1. Run the script in the Windows Command Prompt.
  2. Leave the folder path blank or enter a valid folder path.
  3. Choose organization mode: 3 (By File Size).
  4. The program attempts to create folders with names such as Small (<1MB) and crashes with a syntax error for the folder name.

Expected behavior
The program should sanitize folder names to remove or replace invalid characters so that it works correctly on Windows.

Desktop (please complete the following information):

  • OS: Windows 11
  • Python version: e.g. 3.11

Additional context
This issue only appears on Windows because of filename restrictions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions