Skip to content

Instantly share code, notes, and snippets.

@keyurshah
Created October 13, 2016 17:05
Show Gist options
  • Select an option

  • Save keyurshah/47620245dbfb77afa828b0180ebeb9cd to your computer and use it in GitHub Desktop.

Select an option

Save keyurshah/47620245dbfb77afa828b0180ebeb9cd to your computer and use it in GitHub Desktop.
Parse Magento images into separate directories
; 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