Created
March 6, 2019 11:02
-
-
Save jfrantz1-r7/edff3b7ca214695c925c5b5de6cb7618 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get-destbytype($ext) { | |
Switch ($ext) | |
{ | |
{$ext -match '(jpg|png|gif)'} { "images" } | |
{$ext -match '(txt|docx)'} { "docs" } | |
default {"$ext" } | |
} | |
} | |
ls $dirtyfolder/* | ? {!$_.PSIsContainer} | %{ | |
$dest = "$($org)ORG\$(get-destbytype $_.extension)" | |
if (! (Test-Path -path $dest ) ) { | |
new-item $dest -type directory | |
} | |
mv -path $_.fullname -destination $dest | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment