Just an idea. Maybe a script is more suited to do this kind of job. Something like: create a list of all movie files on the card -> change their extensions to jpg.
--[[
@title Rename avi files to jpg
Original code: disk.lua, http://chdk.setepontos.com/index.php?topic=2902.0
Original author: fudgey 2008/10/27
Licence: GPL v3 or higher
--]]
disk = {}
-- returns list of files that contain the provided search string
function disk.filterImageFiles(searchString)
local imageList = disk.getImageList()
local count = table.getn(imageList)
local i = 0
while i ~= count do
i = i + 1
if(string.find(imageList[i],searchString,17, true) == nil) then
table.remove(imageList,i)
i = i - 1
count = count - 1
end
end
return imageList
end
--[[ Loops through directories within DCIM dir, checks to see
that each directory contains images. returns list of directories.
deletes empty directories
]]
function disk.getImageDirectories()
local imgTable = {}
--get directories that may contain images
local dcimList = os.listdir("A/DCIM", false)
if(dcimList) then
local dirCount = table.getn(dcimList)
table.sort(dcimList)
--loop through directories
local i = 0
while ( dirCount ~= i) do
i = i + 1
--get file list
local imgDirList = os.listdir("A/DCIM/"..dcimList[i], false)
if(imgDirList) then
local imgCount = table.getn(imgDirList)
table.sort(imgDirList)
if(imgCount == nil) then
os.remove("A/DCIM/"..dcimList[i])
table.remove(dcimList,i)
end
else
os.remove("A/DCIM/"..dcimList[i])
table.remove(dcimList,itemCount)
end
end
end
--log.print("-end- getImageDirectories ")
return dcimList
end
--[[ Loops through DCIM dirs and creates list of files ]]
function disk.getImageList()
local imgTable = {}
local dcimList = disk.getImageDirectories()
local dirCount = table.getn(dcimList)
local i = 0
while ( dirCount ~= i) do
i = i + 1
--log.print("A/DCIM/"..dcimList[i].."\n")
local imgDirList = os.listdir("A/DCIM/"..dcimList[i], false)
local imgCount = table.getn(imgDirList)
--log.print("imgCount:"..imgCount)
table.sort(imgDirList)
local a = 0
while (imgCount ~= a) do
a = a + 1
--log.print("A/DCIM/"..dcimList[i].."/"..imgDirList[a])
table.insert(imgTable,"A/DCIM/"..dcimList[i].."/"..imgDirList[a])
end
end
return imgTable
end
--[[
Mass rename of movie files to .JPG, thumbnails are not touched.
Takes advantage of the fact that movie files are usually significantly larger than images, and their full filenames will usually fit into a moderate amount of RAM.
]]
newPicList = disk.filterImageFiles(".AVI")
for index,oldName in ipairs(newPicList) do
namepart = string.sub(oldName,1,24)
os.rename(oldName,namepart..".JPG")
end
The code assumes a file structure for camera files like this:
A/DCIM/xxxCANON/MVI_xxxx.AVI
If the
length of file or folder names are different, the script will not work correctly.
I tried this on a small card with an A470, it managed to rename the two .AVIs
Before you start using it on a camera that has not been tested for this, make a backup of your card's contents, and try this script in play mode. BTW, always run this in play mode.