Search code examples
batch-filemd5checksum

Batch script to change MD5 of all files in every folder


I am using this to change the MD5 of all .rar-files.

FOR %%a in (*.rar) do ECHO.>> %%a

The problem is: The *.bat has to be in the folder where the .rar-files are, but I want to put the *.bat into root.

ROOT
 |----Folder1
          |------*.rar
 |----Folder2
          |------*.rar
 |----Folder3
          |------*.rar

How do I have to change the code that it changes the MD5 of every *.rar that is in every folder?


Solution

  • for /r ROOT %%a in (*.rar) do echo.>>"%%~fa"
    

    should do that job...

    (but I'd remove the >> first as a test to echo the filenames that would be affected - just as a test...)