Compare Directory by File Name ONLY

Here you can propose new features, make suggestions etc.

Moderators: sheep, Hacker, Stefan2, white

Inka
Junior Member
Junior Member
Posts: 3
Joined: 2004-03-08, 08:23 UTC

Post by *Inka » 2018-06-28, 15:05 UTC

Hacker wrote:Inka,
Shift-F2 doesn't help?

Roman
No. I just want to compare the existence of the filenames without any additional parameters

SuprA
Junior Member
Junior Member
Posts: 7
Joined: 2016-09-15, 07:17 UTC

Re: Compare Directory by File Name ONLY

Post by *SuprA » 2019-08-26, 11:11 UTC

It's 2019 already. Is there a way to compare 2 directories only by the file names with one hotkey?

marlar
Junior Member
Junior Member
Posts: 39
Joined: 2010-03-08, 11:18 UTC

Re: Compare Directory by File Name ONLY

Post by *marlar » 2019-08-28, 21:34 UTC

Do you mean by only name and no extension?

If so, what about a situation like this:

Code: Select all

LEFT			RIGHT
myfile.1		myfile.3
myfile.2		myfile.4
What should be the outcome of a comparison on only "myfile" ?

frankk_
New Member
New Member
Posts: 1
Joined: 2017-12-14, 20:03 UTC

Re: Compare Directory by File Name ONLY

Post by *frankk_ » 2019-08-31, 16:05 UTC

marlar wrote:
2019-08-28, 21:34 UTC
If so, what about a situation like this:

Code: Select all

LEFT			RIGHT
myfile.1		myfile.3
myfile.2		myfile.4
That is just extreme situation you are describing, and i get that its maybe not that uncommon, but same time in real most of the time filenames are unique or, at least in my case, i can recognize what i am seeing, and can deal with it adequately changing name or putting files in subdirs. I always struggle for example with trivial situation when i have to compare two dirs with pictures that one have original huge RAW or JPGs and second with converted to small "on screen only" version and in most cases i must do that manually one directory at a time...

It would be awesome to have another option in Synchronize Directories to ignore size and extension, because Shift+F2 in comparing dirs trees between RAW and small JPGs dirs just say:
Image: https://i.ibb.co/d7GfZJB/idntcl.png which is not true ofc :D

marlar
Junior Member
Junior Member
Posts: 39
Joined: 2010-03-08, 11:18 UTC

Re: Compare Directory by File Name ONLY

Post by *marlar » 2019-08-31, 19:55 UTC

I know it is a special situation I sketch out, but still the algorithm would need to know how to handle such a case.

That aside, I appreciate your use case as I often come across it myself. I often set my DSLR camera up to record both a JPG and CR2 file. JPGs are easier to deal with, but then if I need it I also have the raw version. So I typically first go through the JPG folder and delete the files I don't need. And then I must delete the same files in the CR2 folder!

What I do is that I temporarily rename my CR2 files to JPG's and the do the dir sync. I reckon you do the same. But of course it would be easier if TC could do it for us!

And I have a proposal: TC could apply a set of rules and regex's for each dir, where each rule/regex would change the name internally while comparing. Much like the multi rename tool which I often use. So you could make a rule on each side that would ignore extensions. You could also apply a rule that compared only the first 6 characters of the file names etc.

The end result would be that TC would see the filenames after the rules were applied as if the files were originally called that.

Then what about the name clashes I pointed out? Here TC could use the same approach as the duplicate file finder. That is, group the same looking files together within some kind of breaker like dotted lines etc. Then it would be up to you to decide what to do in those cases.

A simpler approach, and arguable much easier to implement for Christian, would be to simply stop with an error: "Cannot compare dirs due to name clash" etc.

User avatar
Usher
Power Member
Power Member
Posts: 584
Joined: 2011-03-11, 10:11 UTC

Re: Compare Directory by File Name ONLY

Post by *Usher » 2019-09-01, 18:07 UTC

2marlar
Did you read the topic linked below?
viewtopic.php?f=3&t=53113
Maybe you should change your method…
Regards from Poland
Andrzej P. Wozniak

marlar
Junior Member
Junior Member
Posts: 39
Joined: 2010-03-08, 11:18 UTC

Re: Compare Directory by File Name ONLY

Post by *marlar » 2019-09-02, 10:31 UTC

Thanks Usher, I didn't know that feature! However, I usually keep my CR2 files in a sub folder called CR2 and the method you point our requires them to be in the same folder.

It is still very useful though :)

User avatar
Usher
Power Member
Power Member
Posts: 584
Joined: 2011-03-11, 10:11 UTC

Re: Compare Directory by File Name ONLY

Post by *Usher » 2019-09-02, 15:34 UTC

2marlar
Folder doesn't matter when you use Ctrl+B for flat view. Just test a little bit more…
Regards from Poland
Andrzej P. Wozniak

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

Re: Compare Directory by File Name ONLY

Post by *petermad » 2019-09-02, 20:17 UTC

2Usher
you use Ctrl+B for flat view
I just tried this. If I Use *.jpg>*.cr2 all jpg's are selected but none of the equivalent cr2's are selected. So it seems that the *.jpg>*.cr2 still only works for files in the same folder, also in Branch view.
License #524 (1994)
Danish Total Commander Translator
TC 9.5b3 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 (1903) 64bit, 'Everything' 1.4.1.935 (x64)
TC 3.0b12 on Android 6.0
Get: Extended Total Commander Menus | PHSM-Calendar

marlar
Junior Member
Junior Member
Posts: 39
Joined: 2010-03-08, 11:18 UTC

Re: Compare Directory by File Name ONLY

Post by *marlar » 2019-09-03, 06:23 UTC

I can confirm petermad's observation. It does not work in flat view.

User avatar
Usher
Power Member
Power Member
Posts: 584
Joined: 2011-03-11, 10:11 UTC

Re: Compare Directory by File Name ONLY

Post by *Usher » 2019-09-03, 16:55 UTC

Hmm, I didn't test it, just guessed. I suspect that it won't work also for Alt+F7 list fed to listbox.
Regards from Poland
Andrzej P. Wozniak

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

Re: Compare Directory by File Name ONLY

Post by *petermad » 2019-09-12, 23:23 UTC

2marlar
That aside, I appreciate your use case as I often come across it myself. I often set my DSLR camera up to record both a JPG and CR2 file. JPGs are easier to deal with, but then if I need it I also have the raw version. So I typically first go through the JPG folder and delete the files I don't need. And then I must delete the same files in the CR2 folder!
I can only think of this workaround:
Put this command in your usercmd.ini file

Code: Select all

[em_copynamestofilewoext]
cmd=%COMSPEC% /C
param=if not exist "%P" (echo •) else (if exist "%T\.SELECTEDFILES.txt" del "%T\.SELECTEDFILES.txt") && for /F "usebackq delims=" %%n in (`type %WF`) do echo %%~nn.*>> "%T\.SELECTEDFILES.txt"
menu=Copy selected filenames without filetype to file in target folder
iconic=1
it will make a file called .SELECTEDFILES.txt in the target folder, with all file names without extension (in Unicode).

Then make this button in the buttonbar:

Code: Select all

TOTALCMD#BAR#DATA
cm_SelectCurrentExtension,em_copynamestofilewoext,cm_ClearAllFiles,cm_wait 500,cm_FocusTrg,cm_LoadSelectionFromFile,cm_ExchangeSelFiles

wcmicons.dll,40
Mark all fles in opposite panel that does not have a matching filename in the source panel


-1
To make the button:
1. Mark the green text above (click SELECT ALL).
2. Copy it to the ClipBoard (press Ctri+C).
3. Right click on TC's buttonbar and choose "Paste".
it will:
1. Mark all files with same extension as file under cursor in current panel.
2. Make the .SELECTEDFILES.txt file in the target panel.
3. Clear the selection in the source panel.
4. Switch to the target panel.
5. Open a Windows dialog to choose the file .SELECTEDFILES.txt (just doubleclick the file, it should be in the top of the list) and mark the files listed in .SELECTEDFILES.txt.
6. Reverse the selection, which should be the files that does NOT have a matching filename in the opposite panel.

Now you can chevk if everything looks allright and press F8 to delete the selected files.

All together requires 3 mouse clicks - one on the button and a doubleclick on .SELECTEDFILES.txt in the Windows "Open" dialog
License #524 (1994)
Danish Total Commander Translator
TC 9.5b3 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 (1903) 64bit, 'Everything' 1.4.1.935 (x64)
TC 3.0b12 on Android 6.0
Get: Extended Total Commander Menus | PHSM-Calendar

Post Reply