1.

Solve : batch to compare and rename same file?

Answer»

Hi,
I would know how to compare files of 2 directories
ex: myBatFile 24
rem @echo off
if EXIST \psipi\rde\%1\ goto suite
if NOT EXIST \psipi\rde\%1\ goto notthere
:notthere
md \psipi\rde\%1\
goto suite

:suite
copy C:\temp\*.pdf \psipi\rde\pdf\%1\*.pdf

REM HERE I WOLD HAVE A BACH TO TELL ME IF in the \pdf directory, the *.pdf FILE is the same as WHITCH in the \temp directory.

If yes, I would rename the \pdf\*.pdf in *_1.pdf with a LOOP in *_1.pdf, *_2.pdf, *_3.pdf ...
(example: there is already a file : 070430.pdf. I wold copy the c:\temp\070430.pdf in the same directory. So the new file will be COPIED with this name : 070430_1.cou)

del c:\temp\*.pdf
goto fin
:eof


:eof
exit

Is there an easy solution to do that.

Thanks a lot and best regards



Discussion

No Comment Found