Page 2 of 3

Re: Replacing duplicates with hard links

Posted: 19 Jul 2021 13:06
by zakoul
Yes. With 1526 duplicates everything works fine.
Thank you !!!

Re: Replacing duplicates with hard links

Posted: 19 Jul 2021 13:15
by zakoul
Checked on another folder.
result text get("Status", 1)

Code: Select all

найдено: 8 227 дублей в 3 602 группах
Result text trim(gettoken(regexmatches(get("Status", 1), "\b[0-9 ]+\b", "|"), -1, "|"))

Code: Select all

602
Instead of 3602

Re: Replacing duplicates with hard links

Posted: 19 Jul 2021 13:20
by highend

Code: Select all

    $txt = "найдено: 8 227 дублей в 3 602 группах";
    text trim(gettoken(regexmatches($txt, "\b[0-9 ]+\b", "|"), -1, "|"));
Outputs "3 602", but not "602"?

Try this:

Code: Select all

$cntAllGroups = replace(gettoken(regexmatches(get("Status", 1), "\b[1-9][0-9 ]*\b", "|"), -1, "|"), " ");
which will remove all spaces

Re: Replacing duplicates with hard links

Posted: 19 Jul 2021 13:40
by zakoul
Not in Find (duplicates) mode, aborted!

Re: Replacing duplicates with hard links

Posted: 19 Jul 2021 13:42
by highend
You did forget to change $dupeColumnName = "Dupes";...

Re: Replacing duplicates with hard links

Posted: 19 Jul 2021 13:56
by zakoul
I'm confused. need to rest.

Re: Replacing duplicates with hard links

Posted: 20 Jul 2021 05:42
by zakoul
Hello. Checked the option with "replace(gettoken(regexmatches(get("Status", 1), "\b[1-9][0-9 ]*\b", "|"), -1, "|"), " ")"
Result 602.
And there is one more problem. A hard link is not created if the name contains an accent mark (U+00B4)

Code: Select all

80´s Movies
The deletion works but the Hard Link is not created.

Re: Replacing duplicates with hard links

Posted: 20 Jul 2021 07:28
by highend

Code: Select all

    $txt = "найдено: 8 227 дублей в 3 602 группах";
    echo replace(gettoken(regexmatches($txt, "\b[1-9][0-9 ]*\b", "|"), -1, "|"), " ");
1.png
1.png (3.13 KiB) Viewed 1885 times
2.png
2.png (3.6 KiB) Viewed 1885 times
Maybe check your code page / font in your console?
Or try to switch the codepage by adding a @CHCP 65001 to the beginning of $batHeader...

Re: Replacing duplicates with hard links

Posted: 20 Jul 2021 08:31
by zakoul
chcp 65001 solved the problem, now hard links are being created.
Did I insert chcp 65001 correctly?

Code: Select all

        $batHeader = <<<>>>
chcp 65001
@ECHO OFF
REG QUERY "HKU\S-1-5-19" >NUL 2>NUL && GOTO :ENDUAC
SET "vbsFile=%TEMP%\~getAdmin.vbs"
IF "%1" NEQ "" (FOR /F "tokens=*" %%I IN ('ECHO %*') DO SET "param=%%~I")

ECHO Set UAC = CreateObject^("Shell.Application"^)> "%vbsFile%"
ECHO UAC.ShellExecute "cmd", "/c """"%~s0"" ""%param%""""", "", "runas", ^1>> "%vbsFile%"
CSCRIPT "%vbsFile%" //Nologo
IF EXIST "%vbsFile%" DEL /Q "%vbsFile%" >NUL 2>NUL
EXIT /B
:ENDUAC
        >>>;
Result echo replace(gettoken(regexmatches(get("Status", 1), "\b[1-9][0-9 ]*\b", "|"), -1, "|"), " ")
Image

Re: Replacing duplicates with hard links

Posted: 20 Jul 2021 09:02
by highend
Did I insert chcp 65001 correctly?
Yeah

Show these two:
echo get("Status", 1)
echo regexmatches(get("Status", 1), "\b[1-9][0-9 ]*\b", "|");

Re: Replacing duplicates with hard links

Posted: 20 Jul 2021 09:14
by zakoul
Image
Image

It depends on the language. Like this in English:
Image

Re: Replacing duplicates with hard links

Posted: 20 Jul 2021 09:42
by highend
echo regexmatches(get("Status", 1), "[1-9][0-9 ]*", "|");
What does this show?

Re: Replacing duplicates with hard links

Posted: 20 Jul 2021 09:53
by zakoul

Code: Select all

8|227 |3|602 

Re: Replacing duplicates with hard links

Posted: 20 Jul 2021 10:19
by highend
That doesn't make sense at all...

Last try:

Code: Select all

text replace(regexreplace(get("Status", 1), "^([^0-9]+?)([0-9 ]+)([^0-9]+?)([0-9 ]+)([^0-9]+?)$", "$4"), " ");

Re: Replacing duplicates with hard links

Posted: 20 Jul 2021 10:24
by zakoul

Code: Select all

найдено:8 227дублейв3 602группах