Created
January 11, 2022 05:15
-
-
Save mburrough/27df23ed27f7ce42468daba67e5384d6 to your computer and use it in GitHub Desktop.
PS Script to sort files scanned by Epson SmartScan Invoice Manager into MM\DD folders
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
#Create month folders | |
foreach($i in 1..12) { mkdir ("{0:00}" -f $i) } | |
#Inspect results before doing move | |
foreach ($file in $files) { | |
$day = $file.Name.split("_")[2].substring(2).substring(0,2) | |
$month = $file.Name.split("_")[2].substring(0,2) | |
$fname = $file.Name | |
echo "$month $day : $fname" | |
} | |
pause | |
$files = gci -File | |
foreach ($file in $files) { | |
$day = $file.Name.split("_")[2].substring(2).substring(0,2) | |
$month = $file.Name.split("_")[2].substring(0,2) | |
$fname = $file.Name | |
echo "$month $day : $fname" | |
mkdir "$month\\$day" | |
mv $file "$month\\$day\\$fname" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment