[Solved] hELP
Posted: 21 Oct 2019 18:23
I required a batch file to compare duplicate text files. DosTipss had helped me. After that, files have grown to over 800 but Limit of batch file seems up to 713:
https://i.imgur.com/2915yCb.png
There are some files generated of different size which it does not compare.
Kindly help.
-----------------------------------------------------------------------------
@Echo Off
SetLocal
Set Prompt=$g$s
Rem I move Versioned Backups to GOOD and the same to the bucket
Rem here: control on duplicate backup files
:: --------------------------------------------------------------------------
Rem Folder
PushD E:\12
:: --------------------------------------------------------------------------
Set Doubles=TRASH
Set Versions=GOOD
Echo Off
For %%i In (%Doubles% %Versions%) Do If Not Exist "%%i\" ( Md "%%i"
If ErrorLevel 1 Exit /B 1
)
For /F "Delims==" %%i In ('2^>Nul Set _') Do @ Set "%%i="
Set /A CountFiles=CountTrash=0
Rem Only files of the same size are compared
Rem Same files (errorlevel = 0) will be marked / moved / removed
Rem System Applicable to (compare / create) backup
For %%i In (*) Do ( SetLocal EnableDelayedExpansion
For /F "UseBackQTokens=1,2*" %%a In ('!CountFiles! !CountTrash! !_%%~zi!') Do (
EndLocal
Set /a CountFiles+=1
Set "EX="
For %%d In ( %%c ) Do If Not Defined EX (
>nul Fc "%%i" "%%~d" && (
Echo Weg %%i
>Nul Move "%%i" TRASH
Set /a CountTrash+=1, CountFiles-=1
Set /a Ex=1
)
)
If Not Defined Ex Set _%%~zi= %%c "%%i"
Title Files %%a Trash %%b
)
)
Title Files %CountFiles% Trash %CountTrash% Done
For /F "Delims==" %%i In ('2^>Nul Set _') Do @ Set "%%i="
Pause
Exit /B
https://i.imgur.com/2915yCb.png
There are some files generated of different size which it does not compare.
Kindly help.
-----------------------------------------------------------------------------
@Echo Off
SetLocal
Set Prompt=$g$s
Rem I move Versioned Backups to GOOD and the same to the bucket
Rem here: control on duplicate backup files
:: --------------------------------------------------------------------------
Rem Folder
PushD E:\12
:: --------------------------------------------------------------------------
Set Doubles=TRASH
Set Versions=GOOD
Echo Off
For %%i In (%Doubles% %Versions%) Do If Not Exist "%%i\" ( Md "%%i"
If ErrorLevel 1 Exit /B 1
)
For /F "Delims==" %%i In ('2^>Nul Set _') Do @ Set "%%i="
Set /A CountFiles=CountTrash=0
Rem Only files of the same size are compared
Rem Same files (errorlevel = 0) will be marked / moved / removed
Rem System Applicable to (compare / create) backup
For %%i In (*) Do ( SetLocal EnableDelayedExpansion
For /F "UseBackQTokens=1,2*" %%a In ('!CountFiles! !CountTrash! !_%%~zi!') Do (
EndLocal
Set /a CountFiles+=1
Set "EX="
For %%d In ( %%c ) Do If Not Defined EX (
>nul Fc "%%i" "%%~d" && (
Echo Weg %%i
>Nul Move "%%i" TRASH
Set /a CountTrash+=1, CountFiles-=1
Set /a Ex=1
)
)
If Not Defined Ex Set _%%~zi= %%c "%%i"
Title Files %%a Trash %%b
)
)
Title Files %CountFiles% Trash %CountTrash% Done
For /F "Delims==" %%i In ('2^>Nul Set _') Do @ Set "%%i="
Pause
Exit /B