0

I made this batch to move or copy items. I was wondering if there is a way to first have it search for the amount of files it needs to move/copy, then display how many items are left as it moves/copys them?

@echo off
set /a counter+=1
set /p folder1=Folder Name:
set TESTFOLDER=%folder1%
set /p Type=Enter File Type:
set /p copymove=Copy or Move:
set /p directory=DIR:
md "%TESTFOLDER%"
set /a counter=0
FOR /F "tokens=*" %%i IN ('DIR /S /B /A-D "%directory%\""*.%Type%"') DO FOR     /F "tokens=*" %%j IN ('DIR /B "%%i"') DO IF EXIST ".\%TESTFOLDER%\%%j" (
    set /a counter=!counter!+1
    echo folder: %TESTFOLDER%
    call %copymove% "%%i" ".\%TESTFOLDER%\"%%j_!counter!.%Type%""
) ELSE call %copymove% "%%i" ".\%TESTFOLDER%\%%j"
:eof
  • This is not really a batch task. If you want to achieve this, I'd use PowerShell rather than batch. You can find a detailed answer here: http://stackoverflow.com/questions/13883404/custom-robocopy-progress-bar-in-powershell. It will be way more efficient and looks really nice. – MichaelS Dec 01 '15 at 12:42
  • Wow that's a lot to look through. I will take a look, thank you. – FootBallBat Dec 01 '15 at 12:47
  • You don't even have to understand it. Just copy the source code to a .ps1 file and use it as suggested in the post. – MichaelS Dec 01 '15 at 12:48
  • There are too many quotes in the `"%directory%\""*.%Type%"` part, it should read `"%directory%\*.%Type%"`... – aschipfl Dec 01 '15 at 13:09

0 Answers0