Compare directories, marking older files

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Ralph
Junior Member
Junior Member
Posts: 97
Joined: 2004-08-21, 14:58 UTC
Location: USA

Compare directories, marking older files

Post by *Ralph »

I often want to find backup files that are duplicates of current files, where the directory organization has changed. Currently, I use Branch View for both source and target directories, so the organization will not matter. Next, I repeatedly use Mark > Compare Directories, Invert Selection, and Show Only Selected Files, until Compare Directories declares that the files in source and target directories look identical. I had assumed that the resulting target files matched the source files, without exception.

However, Branch View allows multiple versions of a given file (same filename but different size or date) to coexist in the same panel. I now realize that the presence in source and target of newer matching file versions can allow older versions to remain when Compare Directories (perhaps incorrectly) declares that the files in the source and target directories look identical. That is, newer matching file versions can block my process from hiding older versions.

Therefore, a command to compare directories but mark older files would be helpful. A command to mark same but hide unmatched files also could be useful. I would need these to work with Branch View.

Example:
Folder1 contains Data.txt, date 2022-02-02, size 1 byte.
Folder2a contains Data.txt, date 2022-02-02, size 1 byte.
Folder2b contains Data.txt, date 2011-01-01, size 1 byte.
Display Folder1 in the source panel, and use Selected Directory Branch (Ctrl+Shift+b) to display Folder2a and Folder2b in the target panel. Use Mark > Compare Directories, which will declare that the files in the source and target directories look identical, even though there is no match for the file dated 2011-01-01.

Thanks
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6450
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Compare directories, marking older files

Post by *Horst.Epp »

And why don't you use Synchronize Dirs
cm_FileSync
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: Compare directories, marking older files

Post by *Hacker »

Horst.Epp,
Horst.Epp wrote:why don't you use Synchronize Dirs
Ralph wrote:the directory organization has changed
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
white
Power Member
Power Member
Posts: 4594
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Compare directories, marking older files

Post by *white »

2Ralph
You may want to search for duplicates (name only) in your files and backup files combined (enter multiple dirs in 'Search in'). Feed the results to listbox and then use the select duplicate file dialog to select all older files.
Ralph
Junior Member
Junior Member
Posts: 97
Joined: 2004-08-21, 14:58 UTC
Location: USA

Re: Compare directories, marking older files

Post by *Ralph »

Horst.Epp,
If there were few directory changes, I may rearrange the old directory structure to align with the new structure, so I can synchronize directories.


White,
I had not been aware of the Select Duplicate Files dialog; thanks. Unfortunately, its options do not appear to include selection of files having equal dates and sizes. I had proposed a Compare directories/mark older command because I could add it to my process, in order to weed out older file versions that otherwise might remain in the target list. In other words, my focus here is on isolating files that match between source and target, and not on older files per se.

I don't want to delete unmatched older files because I sometimes find older versions to be useful. In addition, I think it might be possible for a newer file to appear older because of daylight savings time errors that crept in when I changed computers. When I try to synchronize or compare directories from old sources with my current home or office computer, some file times may differ by 2 hours.

I imagine that my process could become (1) Branch View for both source and target directories and (2) repeated use of Compare Directories, Invert Selection, Show Only Selected Files, Compare Directories/mark older, Invert Selection, and Show Only Selected Files, until Compare Directories declares that the files in source and target directories look identical.
nice
Junior Member
Junior Member
Posts: 84
Joined: 2018-03-12, 23:58 UTC

Re: Compare directories, marking older files

Post by *nice »

not confirmed
both compare, and hide identical works
Ralph
Junior Member
Junior Member
Posts: 97
Joined: 2004-08-21, 14:58 UTC
Location: USA

Re: Compare directories, marking older files

Post by *Ralph »

nice,
For isolating matching files when Branch View is being used, Compare Directories by itself doesn't always give the results I need. For my purpose, Mark Newer, Hide Same Files is not what I need. The example at the bottom of my first post should make the issue clear, if you could please try that.

I should explain why I want to find matching files, regardless of directory reorganizations. I have numerous sets of backed up files, including many copied from other media. If the files in backups match files in my current directories, I can delete the matching backup files, thereby saving considerable space and making examination of the remaining backup files easier.

For example, one of my external hard drives failed partially, but I was not aware of the extent of the problem at that time. I later discovered that some of the data were on backup CDs, but not on my computer. For reasons like this, I don't want to get rid of unique backup information without examination. If I don't have time to go through old files now, I may copy the entire backup set to my computer, delete matching backup files, and move on.
nice
Junior Member
Junior Member
Posts: 84
Joined: 2018-03-12, 23:58 UTC

Re: Compare directories, marking older files

Post by *nice »

if the "extra" file on the right is older than on the left, it's not marked, if it's newer, it's marked.
Ralph
Junior Member
Junior Member
Posts: 97
Joined: 2004-08-21, 14:58 UTC
Location: USA

Re: Compare directories, marking older files

Post by *Ralph »

nice:
if the "extra" file on the right is older than on the left, it's not marked, if it's newer, it's marked.
Yes, but that is not the functionality I am seeking in this case. I need another part of the Venn diagram, not to replace the current Compare Directories command, but to complement the current command. The current command is Compare Directories [and mark newer], but I also need Compare Directories [and mark older]. After adding use of the latter command to my process, I could Invert Selection and Show Only Selected Files, thereby dropping the older unmatched file. The goal of my process is to display only files that are neither older nor newer than the corresponding files in the other panel (and that match on name and size). Then, I can delete those matching backup files. I don't want to delete older files that don't match on the date/time.

If a Mark Same, Hide Different Files command could be added to TC, then my process could be completed in one step.

My other concern is that the Compare Directories command incorrectly declares that the source and target directories match, despite the extra older file.
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Compare directories, marking older files

Post by *petermad »

2Ralph
Try this:
Put these two commands in your usercmd.ini file (located in the same folder as your wincmd.ini file)

Code: Select all

[em_hideallselected]
cmd=cm_ExchangeSelBoth,cm_ShowOnlySelected,cm_ClearAll
menu=Hide selected files and folders

[em_show_duplicates]
cmd=cm_SelectAllBoth,cm_CopyNamesToClip,cm_FocusTrg,cm_GoToFirstEntry,cm_ClearAll,cm_LoadSelectionFromClip,cm_CopyNamesToClip,cm_ShowOnlySelected,cm_ClearAll,cm_FocusTrg,cm_ClearAll,cm_LoadSelectionFromClip,cm_ShowOnlySelected,cm_ClearAll
menu=Show only files and folders that exist in both windows
Then maket his button in your buttonbar:

Code: Select all

TOTALCMD#BAR#DATA
cm_CompareDirs,em_hideallselected,cm_FocusTrg,em_hideallselected,cm_FocusTrg,em_show_duplicates

wcmicons.dll,35
Show only files with same name, size and date


-1
To make the button:
1. Mark the text in the box here above (click SELECT ALL).
2. Copy it to the ClipBoard (press Ctrl+C).
3. Right click on TC's buttonbar and choose "Paste".

Notice that if TC looses focus this display is lost when TC regains focus - that is because this solution uses cm_ShowOnlySelected which only is effective as long as TC has focus.

Currently this solution does not work in Branch view - it seems to only end up showing the files in the "root" of the branch view. So it doesn't solve your problem as you describe it - but it could be useful if you compare directory by directory, to help you find the identical files in one click.

If you want to have the files marked at the end, then replace the last cm_ClearAll in the em_show_duplicates with cm_ClearAllFolders and make sure the panel with the "old" directory is active when clicking the button.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply