I wrote this quick and dirty backup program to take the pictures off of my SLR camera card when plugged in, and download them to my external drive. I have another thread started asking if there's a way to accept external parameters (answered, but still kinda confused on how to use them) (
http://forum.thegamecreators.com/?m=forum_view&t=137780&b=1) for changing pictures paths ~ but this will work for cameras as long as you have the source code, just not for distribution as of yet.
It sorts the pictures by year, and month ~ then it breaks them up if you shot any RAW files (SLR cameras).
Enjoy.
-Blake
Rem Project: imgCopy
Rem Created: 10/1/2008 11:28:27 AM
Rem Blake VandeMerwe
Rem ***** Main Source File *****
SYNC OFF
SYNC RATE 0
SET WINDOW ON
WindowWidth = 500
WindowHeight = 400
SET DISPLAY MODE WindowWidth,WindowHeight,16
SET WINDOW SIZE WindowWidth,WindowHeight
cameraPath$ = "DCIM100CANON"
picturePath$ = "Camera"
checker = 0
Perform Checklist for Drives
for x = 65 to 65+Checklist Quantity()+1
drive$ = chr$(x)+":"
if Path Exist(drive$+cameraPath$) = 1
imgSource$ = drive$+cameraPath$
checker = checker + 1
endif
if Path Exist(drive$+picturePath$) = 1
imgDestination$ = drive$+picturePath$
checker = checker + 1
endif
next x
if checker < 2
while checker = checker
print "A drive couldn't be found. Please check connections."
wait key
endwhile
endif
print "imgSource: "+imgSource$
print "imgDestination: "+imgDestination$
wait key
global runningFiles = 0
global runningBytes = 0
toPrint = 1
global run as boolean = 1 'General run variable
global copy as boolean = 0 '1 = copy, 0 = move
global curError as integer = 0
global dim Error$(999)
global dim Months$(12)
for x = 1 to 12
Read Month$
Months$(x) = Month$
next x
if Path Exist(imgDestination$) = false
Make Directory imgDestination$
print "Image Destination Created, "+imgDestination$
else
print "Image Destination Found, "+imgDestination$
endif
Set Dir imgSource$
Find First
While Get File Type() > -1
analyzeCreation(Get File Name$(),Get File Creation$())
Find Next
Set Window Title "imgCopy ~ Files Copied, "+str$(runningFiles)+" Bytes Copied, "+str$(runningBytes)
EndWhile
While run = 1
if toPrint = 1
for x = 1 to curError
print "Did not copy "+Error$(x)
next x
print str$(runningFiles)+" files copied."
print str$(runningBytes)+" bytes copied."
toPrint = 0
endif
sleep 5
EndWhile
end
data "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"
function analyzeCreation(file$,current$)
setYear$ = right$(current$,4)
currentLength = len(current$)
for x = 1 to currentLength step 1
fileMonth$ = Mid$(current$,x-1)+Mid$(current$,x)+Mid$(current$,x+1)
for y = 1 to 12
if fileMonth$ = Months$(y)
if y < 10
setMonth$ = str$(0) + str$(y)
else
setMonth$ = str$(y)
endif
endif
next y
next x
if Path Exist(imgDestination$ + setYear$) = false
Make Directory imgDestination$ + setYear$
endif
if Path Exist(imgDestination$ + "" + setYear$ + "" + setMonth$) = false
Make Directory imgDestination$ + "" + setYear$ + "" + setMonth$
endif
fileFrom$ = imgSource$ + file$
fileTo$ = imgDestination$ + setYear$ + "" + setMonth$ + "" + file$
if upper$(right$(file$,3)) = "CR2"
if Path Exist(imgDestination$ + setYear$ + "" + setMonth$ + "RAW") = false
Make Directory imgDestination$ + setYear$ + "" + setMonth$ + "RAW"
endif
fileTo$ = imgDestination$ + setYear$ + "" + setMonth$ + "RAW" + file$
endif
if upper$(right$(file$,3)) = "JPG"
fileTo$ = imgDestination$ + setYear$ + "" + setMonth$ + "" + file$
endif
if File Exist(fileTo$) = false
if copy = 1
Copy File fileFrom$,fileTo$
print file$+" copied."
else
Move File fileFrom$,fileTo$
print file$+" moved."
endif
runningFiles = runningFiles +1
runningBytes = runningBytes + File Size(fileTo$)
else
curError=curError+1
Error$(curError) = fileFrom$
print fileTo$+" already exists."
endif
endfunction