Skip to content

Instantly share code, notes, and snippets.

@davutg
Last active February 24, 2021 14:26
Show Gist options
  • Save davutg/71de5ac29107f228d00d783694e15e1e to your computer and use it in GitHub Desktop.
Save davutg/71de5ac29107f228d00d783694e15e1e to your computer and use it in GitHub Desktop.
Batch Scripsts
:: BATCH SCRIPT START
@ECHO OFF
:: Set following variable for file size in Bytes (1024 Bytes=1KB, 1024KB=1MB, 1024MB=1GB)
SET /A FileSize=10485760
:: Set following variable for file extensions to check (*.* = all files)
SET Filter=*.*
:: Set following variable with path to check insided for files
SET Folder=C:\destination\log
FOR /R "%Folder%" %%F IN (%Filter%) DO (
IF %%~zF GTR %FileSize% (
ECHO Deleting "%%F"
DEL /F "%%F"))
EXIT /B /0
:: BATCH SCRIPT END
@ECHO ON
FOR /F "tokens=5" %%T IN ('netstat -a -n -o ^| findstr ":8081" ') DO (
SET /A ProcessId=%%T)
If not defined ProcessId (call 8081.bat) else (echo %date% %time% AlreadyRunning PID %ProcessId%)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment