Last active
May 30, 2018 12:35
-
-
Save 1ijack/cb727c6951d88d105e256fd1675bdb96 to your computer and use it in GitHub Desktop.
Generate a variable Array of all the files size+time+path+name, while printing any duplicates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rem - author: JaCk [https://github.com/1ijack] | |
rem - Name: FileSizeTimeArray.cmd | |
rem - Description: --- To be Run interactive command line only --- | |
rem - Description: Generate a variable Array of all the files size+time+path+name, while printing any duplicates | |
rem - Description: varName syntax - "file{bytes[YYYYMMDDhhmmssPA]}=bytes|YYYYMMDDhhmmssPA|F:\ull\path\filename.extension" | |
rem - srcURL: jxeHead | |
rem - srcURL: https://gist.github.com/1ijack/cb727c6951d88d105e256fd1675bdb96 | |
rem clear list | |
@for /f "tokens=1 delims==" %F in ('set file{') do @set "%F=" | |
rem reset counter and process file info | |
@set "fcnt=0" | |
@for /f "delims=" %g in (' | |
"2>&1 dir /s /b /a:-d "%cd%\*"" | |
') do @for /f "tokens=1-7,* delims=/: " %A in (' | |
"2>&1 dir /a /-c /t:c "%g"" | |
') do @if %F. gtr AL. @( | |
(set /a "fcnt+=1") 2>nul 1>nul | |
if not defined file{%G[%C%A%B%D%E%F]} ( | |
echo/"file{%G[%C%A%B%D%E%F]}=%G|%C%A%B%D%E%F|%g" | |
set "file{%G[%C%A%B%D%E%F]}=%G|%C%A%B%D%E%F|%g" | |
) else @( | |
call echo/SameDateSize: "file{%G[%C%A%B%D%E%F]}" : "%G|%C%A%B%D%E%F|%g" ^<^=^=^> "%file{%G[%C%A%B%D%E%F]}%" | |
call echo/NewUniqueVar: "file{%G[%C%A%B%D%E%F]}%fcnt%=%G|%C%A%B%D%E%F|%g" | |
call set "file{%G[%C%A%B%D%E%F]}%fcnt%=%G|%C%A%B%D%E%F|%g" | |
) | |
) | |
@set fcnt &@set "fcnt=" | |
rem clear list | |
@for /f "tokens=1 delims==" %F in ('set file{') do @set "%F=" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment