Skip to content

Instantly share code, notes, and snippets.

@krowe
Last active August 29, 2015 14:05
Show Gist options
  • Save krowe/ef10bbc9ae9e39924b7d to your computer and use it in GitHub Desktop.
Save krowe/ef10bbc9ae9e39924b7d to your computer and use it in GitHub Desktop.
This file is used for testing various file\directory tasks. It creates a huge directory tree with some error folders very quickly.
@ECHO OFF
IF EXIST TREE (
RMDIR /S /Q TREE
ECHO Tree Removed.
GOTO :EOF
)
FOR %%A IN (1,2,3) DO (
ECHO Creating [ %%A ] and it's sub directories...
FOR %%B IN (%%A_1,%%A_2,%%A_3) DO (
FOR %%C IN (%%B_1,%%B_2,%%B_3) DO (
FOR %%D IN (%%C_1,%%C_2) DO (
call:makeDir ""
call:makeDir "/%%A"
call:makeDir "/%%A/%%B"
call:makeDir "/%%A/%%B/%%C"
call:makeDir "/%%A/%%B/%%C/%%D"
))))
ECHO Tree Created.
GOTO :EOF
:makeDir
SET "TTPTH=TREE%~1/error"
IF NOT EXIST "%TTPTH%" (
MKDIR "%TTPTH%"
FOR %%Z IN (error,err_file,err) DO (
ECHO This is error file [ %%Z.txt ] in [ %TTPTH% ]. > %TTPTH%/%%Z.txt
ECHO This is error file [ %%Z.log ] in [ %TTPTH% ]. > %TTPTH%/%%Z.log
)
)
GOTO :EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment