what is the purpose of this code? how can I use it?

Viewed 29

kindly someone tell me about this batch (I run it but I doesn't see any changes in folder) what is the purpose of this code? how can I use it?

       rem Process the folders
         set i=0
        for /D %%a in (*) do (
        
           rem Store this folder in the next array element
           set /A i+=1
           set "folder[!i!]=%%a"

           rem Separate folder in parts and store the number of the 
          array element in each one
           for %%b in (%%a) do set "part[%%b]=!i!"

        )

        rem Process the files
        for %%a in (*.xml) do (

           rem Get the first part of name
           for /F "delims=-_" %%b in ("%%a") do (

              rem If such a folder exists...
              if defined part[%%b] (

                 rem Get the number of the corresponding array 
         element and move the file
       for %%n in (!part[%%b]!) do ECHO move "%%a" "!folder[%%n]!"
        
               ) else (

                 echo No folder exists for this file: "%%a"

              )

           )

        )
        pause
0 Answers
Related