|
When updating image files for Zen-Cart with _MED and _LRG it's easiest to use some form of batch file or script. I find Windows Powershell to be the easiest way to accomplish this. Following are some examples:
To rename a single file using Windows Powershell: [ this will take a ".php" file and rename it to ".php.original" ] Windows Powershell Syntax: Rename-Item tpl_main_page.php tpl_main_page.php.backup To rename a directory full of files using Windows Powershell: [ this will use the above example and apply it to an entire directory ] Windows Powershell Syntax: Get-ChildItem | ForEach-Object { rename-item $_.name $_.name.replace(".php",".php.original ") } Therefore To rename a directory of Images to include _MED or _LRG for Zen-Cart use the following: Windows Powershell Syntax: Get-ChildItem | ForEach-Object { rename-item $_.name $_.name.replace(".jpg","_MED.jpg") } Windows Powershell Syntax: Get-ChildItem | ForEach-Object { rename-item $_.name $_.name.replace(".jpg","_LRG.jpg") } The same example for renaming a directory of Images to include _MED or _LRG for Zen-Cart using Windows Batch would be: [ this is valid from a cmd line only, to use in a batch file (.bat or .cmd) you will need two % symbols, not one. i.e. %% wherever % is present in the line below ] Windows Batch Syntax: for /f %i in ('dir *.jpg /b') do ren %i %~ni_MED.jpg Windows Batch Syntax: for /f %i in ('dir *.jpg /b') do ren %i %~ni_LRG.jpg If you would like other examples such as Perl, PHP, or VBScript just ask and I'll toss them together. For a ton of ingenious powershell scripts checkout Tom's Powershell blog at http://www.phishthis.com
|