Created
October 13, 2016 17:05
-
-
Save keyurshah/47620245dbfb77afa828b0180ebeb9cd to your computer and use it in GitHub Desktop.
Parse Magento images into separate directories
This file contains hidden or 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
| ; Directives, keywords | |
| #SingleInstance Force | |
| ;change path to source directory, i.e. C:\test\source\*.* | |
| SourceDir = C:\test\source\*.* | |
| Extensions := "jpg,png,tif,bmp,gif" | |
| ;change path to source directory, i.e. C:\test\destination | |
| DestDir = C:\test\destination | |
| FileCreateDir, %DestDir% | |
| Loop Files, %SourceDir%, FR ; Recurse into subfolders. | |
| { | |
| If A_LoopFileExt in %Extensions% | |
| { | |
| FileName = %A_LoopFileName% | |
| StringLeft, varFileNameFirstChar, FileName, 1 | |
| StringMid, varFileNameSecondChar, FileName, 2, 1 | |
| FolderToCopyTo = %DestDir%\%varFileNameFirstChar%\%varFileNameSecondChar% | |
| FileCreateDir, %FolderToCopyTo% | |
| FileCopy, %A_LoopFileFullPath%, %FolderToCopyTo%\%A_LoopFileName% | |
| } | |
| } | |
| MsgBox, Completed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment