Got it! You want a simple, clean way to show progress/status in your batch script without flooding the screen, using dots for files that were "movable" (i.e., the move succeeded) and dashes for files that were deleted.
Here’s a neat approach:
- Print a dot
. if the move succeeded (meaning the file was not locked and can be moved).
- Print a dash
- if the delete succeeded (meaning the file was deleted).
- Print nothing if neither succeeded (file locked or no action).
This way, after each run, you get a line of dots and dashes showing what happened for each file.
Example batch snippet:
@echo off
setlocal enabledelayedexpansion
set "folder=R:\Temp"
rem Loop over files in the folder
for %%F in ("%folder%\*") do (
rem Try to move the file onto itself (to check if it's locked)
move /y "%%F" "%%F" >nul 2>&1
if !errorlevel! equ 0 (
rem Move succeeded, print dot
<nul set /p=.
rem Now try to delete the file
del /f /q "%%F" >nul 2>&1
if !errorlevel! equ 0 (
rem Delete succeeded, print dash
<nul set /p=-
)
)
)
rem Print a newline after processing all files
echo.
endlocal
How it works:
- For each file, it tries to move it onto itself.
- If move succeeds, print a dot
..
- Then try to delete it.
- If delete succeeds, print a dash
-.
- After processing all files, print a newline.
- This way, each run prints a single line of dots and dashes representing the status of each file.
Result example:
...--.-.-.
. = file was movable (not locked)
- = file was deleted
- No output for locked files or files that failed both operations
Optional: Add a timestamp before the line
If you want to see when the batch ran, add this before the loop:
echo %date% %time%
Let me know if you want me to help you integrate this into your 5-minute loop or add logging!