finding duplicated files

J

Jean Pierre Daviau

It sucks on junction points. A french Vista peoblem?

------- delsametemp3.txt ------
"d\Disque-E\Mes " "\Documents\Medical\MaMort"
"d\Disque-E\Mes "
"\Documents\powerPoint\Atelier2006-7_FlashPoint\temp\Sound"
--------------------
 
F

foxidrive

I changed theese lines and it works
del %2 /S & echo.>>out.txt for a list of deleted files
in
if %1 EQU %prev% (>>"%file%7" echo del %2 /S & echo.>>out.txt) else
(>>"%file%7" echo.&>>"%file%7" echo : del %2)

The paths should be fully qualified and I suspect it is because the routine
that writes the fully qualified path names is written for english DIR
terms.
set "t1=%~1"
why not set "t1=%1" ?

It's a practice used in cases where %1 might have double quotes.

It sucks on junction points. A french Vista peoblem?

I think this will also be solved with fixing the routine for fully
qualified path names.
 
J

Jean Pierre Daviau

The paths should be fully qualified and I suspect it is because the
routine
that writes the fully qualified path names is written for english DIR
terms.
::dir /-c/a:-d %1 %2 | sed -e "s/!/|/g" -e "/^ .*/d" -e "/
Volume.*/d" -e "s/Directory of/Directory of : /" >"%file%0"

this line:
for /r %%I in (*.*) do echo %%~zI "%%I" >>zout.txt
gives me that output:

1791 "C:\Users\Jean\Desktop\-.lnk"
261 "C:\Users\Jean\Desktop\187_-_53543.url"
1088 "C:\Users\Jean\Desktop\AceFTP 3 Freeware.lnk"
273 "C:\Users\Jean\Desktop\Acrobat User Community Forums.url"

How could I get

zout.txt | sed -e "s/!/|/g" -e "/^ .*/d" -e "/ Volume.*/d" -e
"s/Directory of/Directory of : /" >"%file%0"

??
 
F

foxidrive

this line:
for /r %%I in (*.*) do echo %%~zI "%%I" >>zout.txt
gives me that output:

1791 "C:\Users\Jean\Desktop\-.lnk"
261 "C:\Users\Jean\Desktop\187_-_53543.url"
1088 "C:\Users\Jean\Desktop\AceFTP 3 Freeware.lnk"
273 "C:\Users\Jean\Desktop\Acrobat User Community Forums.url"

In the routine the filesizes are all padded with leading spaces so they
sort correctly - you can't use the above directly.
 
J

Jean Pierre Daviau

foxidrive said:
In the routine the filesizes are all padded with leading spaces so they
sort correctly - you can't use the above directly.

a- If the file size are not padded the numbers becomes a kind of string
(id) wich is sorted like a string. The paths (as many as there is)beginning
with the same id can be compare sent to a file and then the fsum can be
apply to them only. It is faster.

1791 "C:\Users\Jean\Desktop\-.lnk"
1791 "C:\Users\Jean\Desktop\187_-_53543.url"
b- How can I use a for loop to output the first part of the string and
after the second part of the string using the space as a delimiter.
1791 " "

%1 = 1791
%2 = "C:\Users\Jean\Desktop\-.lnk"
%3 = 1791
%4 = "C:\Users\Jean\Desktop\187_-_53543.url"

if {%1} == {%3} write the two lines to the file.
 
F

foxidrive

a- If the file size are not padded the numbers becomes a kind of string
(id) wich is sorted like a string. The paths (as many as there is)beginning
with the same id can be compare sent to a file and then the fsum can be
apply to them only. It is faster.

Yes, it will work. The routine to output the filesize using %%~za is far
slower than parsing a list from a DIR command though. On the other hand
parsing the list does cause problems with filenames that start with spaces.
1791 "C:\Users\Jean\Desktop\-.lnk"
1791 "C:\Users\Jean\Desktop\187_-_53543.url"
b- How can I use a for loop to output the first part of the string and
after the second part of the string using the space as a delimiter.
1791 " "

%1 = 1791
%2 = "C:\Users\Jean\Desktop\-.lnk"
%3 = 1791
%4 = "C:\Users\Jean\Desktop\187_-_53543.url"

if {%1} == {%3} write the two lines to the file.


set var=1791 "C:\Users\Jean\Desktop\187_-_53543.url"
if {%1} == {%3} for /f "tokens=1,*" %%a in ("%var%") do echo %%b
 
J

Jean Pierre Daviau

Yes, it will work. The routine to output the filesize using %%~za is far
slower than parsing a list from a DIR command though.
On the other hand parsing the list does cause problems with filenames that
start with spaces.
set var=1791 "C:\Users\Jean\Desktop\187_-_53543.url"
if {%1} == {%3} for /f "tokens=1,*" %%a in ("%var%") do echo %%b

Thats great for keeping only one of the duplicates.

I found
for /r . %J in (*.pdf) do @echo %~zJ %J 1>>out.txt
type out.txt | sort >out2.txt
for /f "tokens=1,2" %I in (out2.txt) do echo %I %J wich gives me the two
separated variables I need.
 
J

Jean Pierre Daviau

C:\Users\Jean\Desktop>fsum -jnc -crc32
"C:\Users\Jean\Desktop\Wake_Gallery.pdf"



74105d30 ?CRC32*Wake_Gallery.pdf

How can I get rid of the "
SlavaSoft Optimizing Checksum Utility - fsum 2.52.00337
Implemented using SlavaSoft QuickHash Library <www.slavasoft.com>
Copyright (C) SlavaSoft Inc. 1999-2007. All rights reserved."
?
 
J

Jean Pierre Daviau

Sorry this one works but I still have a problem of blank space somewhere.

---
@echo off
set _un=
set _deux=
set _drapeau=


for /f "tokens=1,2" %%I in (out2.txt) do call :doublons %%I %%J

:doublons

if {%_un%}=={%1} (
if defined %_drapeau% ( @echo. del "%2" >>!doublons.txt
) else (
@echo. :del "%_deux%" >>!doublons.txt
@echo. del "%2" >>!doublons.txt
set _drapeau=1
)
) else (
set _un=%1
set _deux=%2
set _drapeau=
)

goto :EOF
--------
 
F

foxidrive

Sorry this one works but I still have a problem of blank space somewhere.

It seems to have issues here.

out2.txt

123 "c:\abc\def\123.txt"
123 "c:\abc\def\123b.txt"
256 "c:\abc\def\256.txt"
123 "c:\abc\def\123c.txt"


Result:

:del ""
del ""c:\abc\def\123.txt""
:del ""c:\abc\def\123b.txt""
del ""c:\abc\def\256.txt""
:del ""c:\abc\def\256.txt""
del ""c:\abc\def\123c.txt""
:del ""c:\abc\def\123c.txt""
del ""
 
J

Jean Pierre Daviau

try this

123 "c:\abc\def\123a.txt"
123 "c:\abc\def\123 b.txt"
123 "c:\abc\def\123c.txt"
256 "c:\abc\def\256.txt"
 
J

Jean Pierre Daviau

Here it is.

---------------

@echo off
set _un=
set _deux=
set _drapeau=


for /f "tokens=1,*" %%I in (out2.txt) do call :doublons %%I %%J

:doublons

if {%_un%}=={%1} (
if {%_drapeau%}=={1} ( @echo. del %~2 >>!doublons.txt
) else (
@echo. :del %_deux% >>!doublons.txt
@echo. del %~2 >>!doublons.txt
set _drapeau=1
)
) else (
set _un=%~1
set _deux=%~2
set _drapeau=
)

goto :EOF
---
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top