Skip to content

“A Python tool to randomize all files in a directory with numbered prefixes. Reversible and managed via CSV.”

License

Notifications You must be signed in to change notification settings

AutomationsByAuto/FileRandomizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

File Randomizer

A Python tool designed to randomize filenames within a directory by renaming files with numbered prefixes (e.g., _1filename.txt), with a reversible process tracked via CSV. Ideal for automation tasks requiring file organization.
Includes an executable in Releases for easy usablilty.
Remember to "sort by name" in Windows for effective (and fastest) results.
Be patient with the initial use of the .exe
Following this it will run normally.

Features

  • Randomly prefixes filenames with numbers (e.g., _1, _2).
  • Reverses changes using a CSV tracker (DO_NOT_DELETE_all_file_names.csv).
  • Removes prefixes and recreates the CSV if missing.
  • Updates CSV with new or deleted files dynamically.
  • Portable: Includes a standalone .exe for Windows users.

Installation

For Python Users

  1. Clone the repository:
    git clone https://github.com/AutomationsByAuto/FileRandomizer.git
  2. Navigate to the project directory:
    cd FileRandomizer
  3. Install dependencies:
    pip install -r requirements.txt
  4. Run the script:
    python FileRandomizer.py

Note: To build the .exe with PyInstaller, run the script once to generate DO_NOT_DELETE_all_file_names.csv, then use:

pyinstaller --onefile --icon=shuffle.ico --add-data "DO_NOT_DELETE_all_file_names.csv;." FileRandomizer.py

For Executable Users

  1. Download FileRandomizer.exe from the Releases section.
  2. Place it in the directory with files to randomize.
  3. Double-click to run. The initial run may be slow; subsequent runs are faster.

Usage

Run the script or executable in the target directory and choose an action:

  • rs: Randomly sort files by adding numbered prefixes.

  • cb: Revert files to their original names.

  • rp: Remove prefixes and recreate the CSV (note: files originally starting with a number may lose that number).

  • ex: Exit the program.

  • The script creates DO_NOT_DELETE_all_file_names.csv to track filenames. Do not delete this file, as it’s required for reverting changes. Although the rp function can mostly fix this issue if the file is deleted.

  • In Windows, sort the directory by name to view prefixed files in numerical order (e.g., _1file.txt, _2file.txt).

  • Note: The .exe may take a few seconds to load initially due to PyInstaller’s unpacking process.

Requirements

See requirements.txt for dependencies (e.g., pandas).

Motivation

I found I was unable to organise a directory of images and videos randomly in Windows so I coded this solution.

Built as my first step into automation engineering, this tool demonstrates file manipulation, user interaction, and portability—core skills for automating repetitive tasks.

License

MIT License - feel free to use, modify, and distribute.

Contact

Ray Pitcher - mass.automation.solutions@gmail.com

Aspiring Automation Engineer | Open to feedback and collaboration!

About

“A Python tool to randomize all files in a directory with numbered prefixes. Reversible and managed via CSV.”

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages