Skip to content

Instantly share code, notes, and snippets.

@r-plus
Created January 30, 2014 08:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r-plus/8704808 to your computer and use it in GitHub Desktop.
Save r-plus/8704808 to your computer and use it in GitHub Desktop.
create files for mtime execution handling test on windows.
# make many directories
cd ~\test
for ($i=0; $i -lt 100; $i++) {
New-Item $i\00 -type directory | Out-Null
New-Item $i\99 -type directory | Out-Null
}
# create files and tweak modify-date if file number is even.
function CreateNewFiles($path)
{
cd $path
for ($i=0; $i -lt 10; $i++) {
New-Item $i -type file | Out-Null
$even = $i%2
if ($even -eq 0) {
Set-ItemProperty $i -name LastWriteTime -value "2000/01/01 00:00:00" | Out-Null
}
}
}
$dirs=`ls`
foreach ($d in $dirs) {
CreateNewFiles("~\test\$d\00")
CreateNewFiles("~\test\$d\99")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment