Find duplicate or similar folders and replace them with the new version

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Deltaflight84
Junior Member
Junior Member
Posts: 11
Joined: 2023-08-27, 11:03 UTC

Find duplicate or similar folders and replace them with the new version

Post by *Deltaflight84 »

Hi i want that TC controls in more paths (3 different Hard Drives) duplicates folders names, and replace that folder with the new version, let me be more accurate:

I have 3 HD with multiples scenery for Flight Simulator 2020 in three paths:

I:\MSFS Addons 2
J:\MSFS Addons
H:\MSFS Addons 3
The path that contains the new versions scenerys is: E:\temp

my goal isthat TC checks in these 3 paths, the folders that already exist with the same name but at the end of the name folder the new ascending version, and obviously puts those with the older version in a specific path E:/ backup

i know that is hard to understand i don't know more how to explain this necessity
Thx in advance
User avatar
beb
Senior Member
Senior Member
Posts: 435
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: Find duplicate or similar folders and replace them with the new version

Post by *beb »

If your task implies full automation, I can see no way it could be fulfilled within the Total Commander scope, sorry.
Still, it can be done manually step by step using the synchronize dirs functionality.
In the case of full automation, I would prefer PowerShell as a suitable and capable tool (even though some fellow users here seemed to begin to hate me for that, lol).
In any case, you would need to articulate more clearly the details and conditions of your task since it's pretty challenging even to understand it by now, let alone to begin any practical probes.
Cheers.
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10
User avatar
beb
Senior Member
Senior Member
Posts: 435
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: Find duplicate or similar folders and replace them with the new version

Post by *beb »

To begin with, try the below script as a first approach:

PowerShell_MSFSsceneries_hashProbe.ps1

Code: Select all

$backup = @(
# put here below the actual paths where the saved sceneries reside considering the given syntax
# note: each path should represent a single saved scenery (not a collection of those)
'I:\MSFS Addons 2',
'J:\MSFS Addons',
'H:\MSFS Addons 3',
'E:\temp',
'E:\backup')

foreach ($scenery in $backup) {
$tmp = (Get-ChildItem -Recurse $scenery | Get-FileHash -Algorithm MD5).Hash | Out-String
$md5 = (Get-FileHash -Algorithm MD5 -InputStream ([IO.MemoryStream]::new([char[]]$tmp))).Hash
Write-Host "md5: $md5 $scenery"
}

pause
If the truly identical scenery copies do exist, the script will return identical [md5] hash sums for them (for their corresponding paths).
Last edited by beb on 2023-12-18, 21:47 UTC, edited 1 time in total.
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: Find duplicate or similar folders and replace them with the new version

Post by *Fla$her »

2Deltaflight84
Your question is not solved using TC, besides, when using permanent paths, it doesn't need to interact with it in any way. For this purpose, stand-alone scripts or other automation tools are used. To be honest, you chose the forum incorrectly.
Overquoting is evil! 👎
Post Reply