Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bohack/00df345808b588c445a6cf42f662b6ac to your computer and use it in GitHub Desktop.
Save bohack/00df345808b588c445a6cf42f662b6ac to your computer and use it in GitHub Desktop.
Creating a Specific File Size for Testing
@ECHO OFF
REM Jon Buhagiar
REM 06/29/17
REM Create really large files
IF {%1}=={} (goto :ERRHAND)
SETLOCAL
SET /A maxsize=%1*1000
SET /A X=0
DEL bigfile.tmp 2> NUL
DEL bigfile.txt 2> NUL
ECHO Building seed file....
:SEED
ECHO.The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. >> bigfile.tmp
SET /A X=%X%+1
IF %X% GTR 1336 GOTO :LOOP
GOTO :SEED
:LOOP
TYPE bigfile.tmp >> bigfile.txt
FOR %%A IN (bigfile.txt) DO set size=%%~zA
IF %size% LSS %maxsize% (
ECHO.File is %size% bytes
GOTO :LOOP
)
GOTO :END
:ERRHAND
echo.
echo Usage %0 {size of file in KB}
echo.
:END
DEL bigfile.tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment