How to compare two directories?

English support forum

Moderators: white, Hacker, petermad, Stefan2

鸞鸞鸞
Junior Member
Junior Member
Posts: 16
Joined: 2020-08-19, 04:36 UTC

How to compare two directories?

Post by *鸞鸞鸞 »

I'm talking not about synchronization. I'm looking for a tool that works: we have two panels. At first panel we have 100 files and folders. At second one we have 70 files and folders and many of them are from the first panel. I make the first one an active. After use the tool and it selects files and folders from the first panel that are not in the second one. After that i can easy press F5 and copy that files and folders.
鸞鸞鸞
Junior Member
Junior Member
Posts: 16
Joined: 2020-08-19, 04:36 UTC

Re: How to compare two directories?

Post by *鸞鸞鸞 »

For instance: at left we have files: 1, 2, 3, 4, 5. At right we have: 1, 4, 5. When i press the tool button i get selected files 2 and 3.
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: How to compare two directories?

Post by *Stefan2 »

Maybe

Menu "Commands > Synchronize Dirs..."


Or
Menu "Mark > Compare Directories" (cm_CompareDirs=533;Compare dirs)
(cm_CompareDirsWithSubdirs=536;Also mark subdirs not present in other dir)


Or use
Save Selection (cm_CopyNamesToClip=2017;Copy filenames to clipboard)
go to other panel and
Load Selection (cm_LoadSelectionFromClip=2033;Read file selection from clipboard)


See text file "TOTALCMD.inc"


And see Extended English Menus for Total Commander by petermad
https://www.ghisler.ch/board/viewtopic.php?t=33740
Screenshot: http://madsenworld.dk/wincmd/tc9win10en.gif




 
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: How to compare two directories?

Post by *petermad »

2鸞鸞鸞
After use the tool and it selects files and folders from the first panel that are not in the second one.
Make this button in TC's button bar:

Code: Select all

TOTALCMD#BAR#DATA
cm_SelectAllBoth,cm_CopyNamesToClip,cm_FocusTrg,cm_GoToFirstEntry,cm_ClearAll,cm_LoadSelectionFromClip,cm_CopyNamesToClip,cm_ExchangeSelBoth,cm_FocusTrg,cm_ClearAll,cm_LoadSelectionFromClip,cm_ExchangeSelBoth

wciconex.dll,72
Mark files and folders that does not exist in both windows


-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".
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
鸞鸞鸞
Junior Member
Junior Member
Posts: 16
Joined: 2020-08-19, 04:36 UTC

Re: How to compare two directories?

Post by *鸞鸞鸞 »

Stefan2 wrote: 2021-07-31, 15:17 UTC
No, synchronization is a different tool. Compare directories does the different action and i can't understand what exactly it does.
鸞鸞鸞
Junior Member
Junior Member
Posts: 16
Joined: 2020-08-19, 04:36 UTC

Re: How to compare two directories?

Post by *鸞鸞鸞 »

petermad wrote: 2021-07-31, 17:22 UTC
Thanks, will try.
鸞鸞鸞
Junior Member
Junior Member
Posts: 16
Joined: 2020-08-19, 04:36 UTC

Re: How to compare two directories?

Post by *鸞鸞鸞 »

petermad wrote: 2021-07-31, 17:22 UTC ----
It doesn't work.

Image: https://pasteboard.co/KdRNehr.png
User avatar
Gral
Power Member
Power Member
Posts: 1460
Joined: 2005-01-26, 15:12 UTC

Re: How to compare two directories?

Post by *Gral »

Use

Code: Select all

cm_CompareDirsWithSubdirs
internal command. From command line or add to menu.
鸞鸞鸞
Junior Member
Junior Member
Posts: 16
Joined: 2020-08-19, 04:36 UTC

Re: How to compare two directories?

Post by *鸞鸞鸞 »

Gral wrote: 2021-08-01, 15:15 UTC Use

Code: Select all

cm_CompareDirsWithSubdirs
internal command. From command line or add to menu.
Thank you.
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: How to compare two directories?

Post by *petermad »

2鸞鸞鸞
It doesn't work.
There is no way you can get a "file not found!" mesage if you have done as instructed - Please try again - follow the procedure excactly:
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".
Also - I don't see my suggested button in your buttonbar in your screenshot.
Last edited by petermad on 2021-08-01, 20:14 UTC, edited 4 times in total.
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
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: How to compare two directories?

Post by *petermad »

Gral wrote: 2021-08-01, 15:15 UTC Use

Code: Select all

cm_CompareDirsWithSubdirs
internal command. From command line or add to menu.
This wil mark files that exists in both panels if they have different size or date - that is not what 鸞鸞鸞 asks for
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
鸞鸞鸞
Junior Member
Junior Member
Posts: 16
Joined: 2020-08-19, 04:36 UTC

Re: How to compare two directories?

Post by *鸞鸞鸞 »

petermad wrote: 2021-08-01, 20:00 UTC
There is no way you can get a "file not found!" mesage if you have done as instructed - Please try again - follow the procedure excactly:

It doesn't work. I did all correct. I tried on TC 9.51. Will update and try on the newest.

Also - I don't see my suggested button in your buttonbar in your screenshot.
You can't see your icon coz I use a different icon library. I have no icon library as in your code.
Last edited by 鸞鸞鸞 on 2021-08-02, 10:08 UTC, edited 2 times in total.
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: How to compare two directories?

Post by *Stefan2 »

鸞鸞鸞 wrote: 2021-07-31, 14:37 UTC At first panel we have 100 files and folders.
At second one we have 70 files and folders and many of them are from the first panel.

I make the first one an active.
After use the tool and it selects files and folders from the first panel that are not in the second one.
After that i can easy press F5 and copy that files and folders.


I have LEFT
1\
2\
3\

4\
5\
File2.txt
File4.txt



I have RIGHT
1\
4\
5\
File1.txt
File2.txt
File3.txt



After executing petermad's command, these are selected:
- Left 2\ 3\ + File4.txt
- Right File1.txt + File3.txt

The same as with internal command   cm_CompareDirsWithSubdirs



But   cm_CompareDirsWithSubdirs    will also "..mark files that exists in both panels if they have different size or date.."
...depended, which file is newer in one or another panel. (Try to modify File2.txt in LEFT or RIGHT panel to see the differences)
Petermad's command will just select non-existent files/folders, no matter if modified or not.








 
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: How to compare two directories?

Post by *petermad »

2鸞鸞鸞
It doesn't work. I did all correct. I tried on TC 9.51. Will update and try on the newest.
I just tried it in TC 9.51 - it works there too for me.
You can't see your icon coz I use a different icon library. I have no icon library as in your code
You are right, it should have been wcmicons.dll and not wciconex.dll (wcmicons.dll should be installed by default).

New code (with correct icon library):

Code: Select all

TOTALCMD#BAR#DATA
cm_SelectAllBoth,cm_CopyNamesToClip,cm_FocusTrg,cm_GoToFirstEntry,cm_ClearAll,cm_LoadSelectionFromClip,cm_CopyNamesToClip,cm_ExchangeSelBoth,cm_FocusTrg,cm_ClearAll,cm_LoadSelectionFromClip,cm_ExchangeSelBoth

wcmicons.dll,72
Mark files and folders that does not exist in both windows


-1
Could you try this for me: Right-click on the button you have with my code and choose "Copy" - and then paste it (with Ctrl+V) in a post here in this thread.
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
鸞鸞鸞
Junior Member
Junior Member
Posts: 16
Joined: 2020-08-19, 04:36 UTC

Re: How to compare two directories?

Post by *鸞鸞鸞 »

petermad wrote: 2021-08-02, 19:31 UTC 2鸞鸞鸞
It doesn't work. I did all correct. I tried on TC 9.51. Will update and try on the newest.
I just tried it in TC 9.51 - it works there too for me.
I was mistaken. My portable version was 8.52. I have updated to 10 and now your script works. Thank you.
Post Reply