windows - How to create dummy (fake) file and folder with batch .bat or .cmd -
several times, have tried find easy , simple way generate files , folders different size testing purpose. although there many complex way on google or other place use vbscript or perl, want simple 1 (.bat or .cmd files) can run easly on windows 7 or 8.1 , generate dummy files , folders...
copy code bellow , paste , save "dummyfilefolder.bat" file.
@echo off rem ---------------------------------------------------------------------- rem fill current directory out dummy files & folders rem rem usage: dummyfilefolder.bat [foldernumber] [filenumber] rem rem [foldernumber] define number of folder rem create (default=10) rem rem [filenumber] define number of files create rem inside each folder (default=5) rem rem example: dummyfilefolder.bat 2 5 rem fill current directory 2 folders have rem 5 files inside each them. rem ---------------------------------------------------------------------- setlocal enabledelayedexpansion set folderno=%1 set fileno=%2 if not defined folderno set folderno=10 if not defined fileno set fileno=5 echo. echo creation of %folderno% folder(s) , %fileno% file(s) started... echo. echo plese wait... echo. echo. echo. /l %%i in (1,1,%folderno%) call :mytask %fileno% echo. echo ********************************************** echo. echo task finished successfuly. echo. echo ********************************************** echo. pause :mytask set fileno=%1 set foldername=%random% md %foldername% /l %%i in (1,1,%fileno%) dir /q /s > %~dp0%foldername%\!random!.txt goto :eof
Comments
Post a Comment