Skip to content
rar0nPublic

About

Directory Compare app in Python, for Linux and Windows.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

271 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DirComp - Directory Compare and Duplicate Finder

Two modes

  • Compare Folders
  • Duplicate Finder

WIP! (Work in progress)

IMPORTANT NOTE !

Use this at your own risk! I take no responsibility if you delete any files or folders you didn't want to, or otherwise mess up anything using this program! Back up your files! (And also your folders!)

Compare Folders (Gloaming Grey theme)

image

Duplicate Finder (My Dark based colorful theme)

image

Features (WIP)

  • Two main modes (central buttons at the top of Main tab)
    • Compare Folders
      • Compare two folders side-by-side (Optionally manually synchronize their contents)
    • Duplicate finder
      • Re-uses right-side pane to display duplicate files that are in the left pane
      • Two view modes
        • In folders: Show all duplicate files with their parent folders (Tree view)
        • In file sets: Each item in the list represents a set of duplicate files in the left pane, with a count (Flat list)
      • Selecting duplicates on the right pane also selects all duplicates in the left pane
  • Comparing files based on
    • Filename, size and / or date (File extension(s) optional)
    • Hash value
    • Fingerprint (quick hash beginning / end of file + filesize)
  • Two views pr pane (left / right)
    • Tree view of files and folders (File List View)
      • Color coded for at-a-glance for which items are missing from either side
      • Synchronize Views (Same selection in both panes, if the corresponding item (file or folder) exists in the other pane)
      • Copy items from one pane and pasting it automatically re-create their folder structure up to the pane's root (recreating relative path)
    • Statistics view (bar charts)
      • Bar chart overview of files or folders
        • Timeline (from oldest to newest item)
        • File sizes
        • File Filter entries (E.G. file extension statistics counts)
      • Two modes in Statistics View
        • Files
        • Folders
      • Select files or folders via (multi) selecting bars or a range of bars
      • Unselect all files or folders by clicking in an empty area inside Statistics View
  • Symmetrical (ish) GUI, or not, depending on settings.
  • Color customization (theme colors, custom colors for most buttons etc.)
  • Cached folders
  • Manual Snapshop of folders (see what was there, can also be used for comparisons, selections)

Nice-to-have

  • Save selected items as a plain text list

Road map / planned wish list / Maybe

  • Layout tweaks?
  • Other?

Vibe coded

Yes. Full disclosure: I don't know Python that well. Claude does though :-)

Started with Claude 5 free over a couple of months, continued for a coupe more with a sub, mostly Claude Sonnet 5.5 at medium effort. This is not a one-shot slop (if I may say so myself). I'm happy with how this has turned out so far.

Note: Most of the source code comments is Claude's. Some (not all) of the reasoning behind why something is done is Claude's assumption and may be a bit off. But a lot is on-point as well!

Install

Requires Python 3.10 or newer.

Getting the program

Either download the repository as a ZIP file from the GitHub page (green Code button, then Download ZIP) and extract it into a folder, or use git to clone it into a local folder:

git clone https://github.com/rar0n/DirComp.git
cd DirComp

With a clone, git pull later fetches updates.

Linux

  1. Get the program into a folder (see above). cd to that folder or just right-click the folder and select "Open in Terminal".
  2. Install dependencies into a venv (virtual environment):
    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
    (If python3 -m venv complains about ensurepip, you may need sudo apt install python3-venv.)

Windows

  1. Install Python if you haven't. In the installer, tick "Add python.exe to PATH".

  2. Get the program into a folder (see above). In File Explorer, open the folder, type cmd (or powershell) in the address bar and press Enter, to open a terminal there.

  3. Create the venv and install dependencies. The venv is created the same way in both shells, only activating it differs:

    Command Prompt:

    python -m venv venv
    venv\Scripts\activate
    pip install -r requirements.txt

    PowerShell:

    python -m venv venv
    .\venv\Scripts\Activate.ps1
    pip install -r requirements.txt

    (If PowerShell refuses to run the activate script with an error about execution policies, run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once, or just use Command Prompt.)

    If python isn't found, try py -m venv venv instead.

(The venv prompt shows (venv) when it's active. Activate it again in each new terminal.)

Usage

Run it by starting main.py from its folder, in a terminal. You must activate the virtual environment (venv) first:

Linux:

source venv/bin/activate
python3 main.py

Windows (Command Prompt):

venv\Scripts\activate
python main.py

Windows (PowerShell):

.\venv\Scripts\Activate.ps1
python main.py

INSTRUCTIONS

(WIP - Not finished writing yet, sorry! Atm these short instructions will have to do)

In any case, I will suggest that you make 2 dummy test folders with unimportant files and folders in them, some of which are copies of each other's contents. Add each folder to it's own left / right pane, and just play with the software to see how it works.

IMPORTANT NOTE ! (Again)

Use this at your own risk! I take no responsibility if you delete any files or folders you didn't want to, or otherwise mess up anything using this program! Back up your files!

NOTE!

Most file listings depend on:

  • Global File Filter filtering (it has its own "Clear" button, any selections are OR-ed, optionally everything inverted)
  • Recursive Folder Selections setting (whether or not to scan inside non-expanded folders in the upper view)

Main modes

  • Compare Folders

    Basically, you set two "root" folders, one in each pane (left / right pane) view, and can compare their contents, copy / move files or folders between them, etc.

    The entries in the drop-down history list above the file view can be deleted by hovering over them and press "DEL", or "Clear History" button under "Global Settings" - "Options", in Settings tab. You have to press "Save Settings" button in Setttings tab for this to be persistent, however. Otherwise the old contents can be reloaded on next program start, or next time you reload settings (Almost any setting is saved in the settings file, except the cache which use a SQL file)

    You can also save a folder in a "Snapshot" file (similar to a cache), and later load it (To e.g. compare differences, but ofc any cut/copy/paste to/from a Snapshot isn't possible)

  • Duplicate Finder

    The other main mode. The right side pane is re-used, listing duplicates found in the left pane's folder..

    In this mode, the right pane's button groups is swapped for most of the Comparison Options settings.

GUI

Each pane (left and right) shows files or folders in 2 different views

  • Treeview (File List View)

    • Just your standard tree view of files and folders (also somewhat unfortunately called File List View in code, my bad)
  • Statistics View

    • 2 modes: Files or Folders
    • A bar chart with some different types of statistics (date timeline, file sizes, File Filter matches)
  • Tree view / File List View (FLV)

    Buttons above

    • Up - Go up one folder
    • Select Directory - just opens a folder (directory) as the pane's root folder. (Simples to just drag'n'drop a folder into a view)
    • "Save Snapshot" - Just saves a json with file metadata. Can load into a view for comparing with old content.
    • Refresh - Reloads and re-builds the file list with whatever Comparison Type is set (so a hash will re-hash everything - slow!)
    • Hash New - Hashes files that are currently not hashed (if some are hashed earlier, it will skip these - unless the cache is clesred)

    Buttons below FLV

    • "+" - Expands all folders
    • "-" - Contracts all folders
    • Clear view - removes the root folder, clears the view.
  • Statistics View (SV)

    Buttons above

    • Files / Folders - Selects statistics type
    • Zoom to - Zooms to a ranged selection
    • Reset view - resets view to show all entries

    Buttons below SV

    • Log height - Logarithmic count (Y axis)
    • Auto range - Automatic Y axis range
    • Set range - Click to manually auto range
    • Plus / Minus - Zoom in / out
    • Metric - Type of statistics
    • Log size - Logarithmic X axis (for size only).
  • Button panels

    The buttons at the bottom part is divided into a few groups

    • Select
    • File Op
    • Clipboard
    • Both Panes (central group applying to both panes)
  • Select buttons

    Note It is implied that the files are compared to the same relative locations on the other pane / folder

    Most are additive, each select button adds to the current selection. If you want to select from a "blank slate" (nothing selected at first), then press Clear (in this group) first! This group differs slightly in the two main modes:

    Compare Folders mode
    • Missing (Select files that exist here but are missing on the other pane)
    • Matching (Selelct files that exists in both panes)
    • Newer (Files exist in both panes but this pane's is newer)
    • Older (As above but this is older)
    • Smaller (Files exists in both panes but this has a smaller filesize)
    • Larger (As above except this side has the larger filesize)
    Duplicate Finder mode
    • Duplicates (Select all files in all duplicate file sets (A duplicate file set is just a collection of files that are identical to each other)
    • Extra copies (As above, except un-select 1 copy of each duplicate set, so as to not delete all of them for example)
    • Sel. Dups (From an existing selection, select all duplicate file sets, ignoring un-selected items)
    • Sel. Extras (As above, but leave 1 file in each duplicate set un-selected, to spare 1 copy)
    Common:

    Your basic Select All, Clear, Invert (selection) and a couple of auxillaries:

    • All Parents - Select an items parents all the way up to the top of the pane's root folder
    • All Childs - The reverse of the above, selects everything inside a folder
    • Item Parent - Select an item's (file or folder) parent folder
    • Item Child - Select a folders content, but only one level down
  • Clipboard buttons

    There's the basic cut/copy/paste, except it's not as basic perhaps, as it will re-create any parent folders of any selected item that is pasted. So if you select a file or folder deeply nested, it will paste the item in the same deeply nested folder structure, re-creating it. Exception is if you paste in an ordinary file explorer instead of in DirComp. Other buttons:

    • Paste Folders - as the name implies, pastes only folders of the selection, ignoring the files
    • Paste Flat - Pastes everything in one folder (ignoring the folder structure)
    • Move--> - Simply moves the selection to the other pane
    • Copy--> - As above but copies it
  • File Op

    Self explanatory, rudimentary implemented for now.

  • Both Panes buttons

    Just two functions for now:

    • Sync - A powerful button, be very careful!! That is, be SURE that the left and right folders should be copies of each other! Newest file wins if the same file exists in both panes.
    • Swap - Just swaps left and right. If done in "Duplicate Finder", swaps the hidden right side with the visible left, for finding duplicate files.
  • Global File Filter

    This filters which files is shown in the tree view (File List View), and thus also in Statistics View

    • Multiple entries are OR'ed together
    • Optionally invert the whole filter
    • Clear button clears it.
  • Quick Options

    This is just an excerpt from the Settings tab

    • Recursive Folder Selections - Sets wither all folders are scanned (on), or only the already expanded ones (off)
    • Expand to Selection - If the above is on, selects if the folder is expanded in the tree view (FLV), if something inside it is selected (E.G via a Select button)
    • Synchronize Views - Scrolling and selections are synchonized between views, if possible.
    • Symmetrical (ish) GUI - Whether or not (most of) the buttons on the right pane have mirrored placements from the left pane.
  • Comparison Type

    Only shown in "Duplicate Finder" mode

    • Similar to Quick Options, it's just a set of handy options shown here as well as in Settings tab

Settings tab

Sets Theme, lots of custom colors for highigths and other stuff. Basically a zillion settings there now :P (Lots of colors and theming, but not everything)

Comparison Options

(Settings tab, Global Settngs)

Which files are considered "counterparts" or "identical" of each other is set here (Though not necessarily exactly identical, depending on these settings).

  • Name, size and date - they all must match
  • Name and size
  • Name
    • With any of the Name types, you may ignore file extension(s).
  • Hash value (Slow, a selection of hashing algorithms available. Most accurate)
    • Hash value is the slowest by far initially as it needs to hash the complete files.
  • Fingerprint (Quickly hash only a subset + file size)

Name, size and date is the most basic method. It might mistake same-named files for the same file (but shows date or size difference). It might be sufficient, depending on use case. Perhaps you only want a visual comparison of file sets that differs only with file extensions, for example.

Fingerprint is a shortened hash value, very fast but it's only hashing the file size and start and end chunks of a file (conceivably it could be altered in the middle while still having the same file size and fingerprint value, and a difference will be unnoticed and ignored as such).

Known issues

Nothing major, but starting the program has become a bit slow lately, 2-3 seconds ish (not measured).

About

Directory Compare app in Python, for Linux and Windows.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages