by Will Li | https://github.com/williamli9300/CullRawByJPG/ | v0.1.0
A simple Python script to cull RAW files based on deleted JPEG files in a directory.
You can change the verbosity (i.e., is the name of every recycled file printed to console, or only the number of deleted files) by changing the value of verbose on line 11 to True or False.
Recommend verbose = True for < 700 files to delete, and verbose = False for > 700 files to delete, to prevent crashing.
You can change the number of files to give a status update if using verbose = False by changing report_every_n_files on line 12.
- Cull compressed photos by reviewing JPEGs and deleting (e.g. sending to Recycle Bin/Trash) undesired JPEGs.
- Download the source code from this link or from
<> Code>Download Zipon the project front page, then extract the archive. - Copy the script
CullRawByJPG.pyinto your desired directory containing RAW and JPEG files. - If your RAW format of choice is
*.CR3, skip to Step 6. Otherwise, openCullRawByJPG.pyin a text editor or IDE. - Change the
raw_typevariable on line 7 to your desired format, in uppercase, including the delimiter (.), according to the examples given. - Run the script by opening a Windows Command Prompt or macOS Terminal window in your desired directory, then running
python3 CullRawByJPG.py.
- Open
CullRawByJPG.pyin a text editor or IDE. - Change the
compressed_type_1andcompressed_type_2variables on lines 8-9 to your desired format(s), in uppercase, including the delimiter (.), according to the examples given. If you are only using one compressed format, e.g..PNG, keepcompressed_type_2 = ".JPEG"(this part of the script shouldn't do anything if you don't have any JPEGs in your folder. If you do have JPEGs in your folder, change ".JPEG" to something that's not in any of the filenames, such as "LoremIpsumDolorSitAmet".)
- Written in and requires Python 3.
- Requires the Python Send2Trash library. Install using
python3 -m pip install Send2Trashin Command Prompt or Terminal, or by following instructions given on the project page. - Works with extensions that are both UPPERCASE or lowercase (e.g.
.CR3and.cr3). - Works with JPEGs using both
.JPG/.jpgand.JPEG/.jpegextensions. - In theory, this script works on both Windows and macOS, but only tested on Windows 11.
- A folder containing RAW and JPEG files with the same names (minus extension). The script will search for RAW files without a correspondingly named JPEG file.