Digital Photos SD stick getting Bigger and Bigger

by MYLE 5. August 2010 04:30

Take a Photo now a days you seen not to run out of film have a 12GB one put in the Photo Frame and a 2GB one in my camera

My problem is I hate renaming photos last count over 9,000 photo

so hes a script I wrote to take all images in a folder look at the Last Modified date and Create a Year folder then the Month folder and copy the file there. 1 FSO.Deletefile(file)

 

'************************************************
'
' Copyright MYLE 2010
'
' This will copy all file and subfolder from Your Photo Location
' and rename then to a number as the photo frame does not care for File Name
' AS you could have File with the Same name in a Differance folder.
' You Need to Setup 5 thing
' 1. StartFrom    where are the Photos
' 2. CopyTo       Which Drive is the Stick in
' 3. EXT_OK       What ext do you want to copy over.
' 4. LenEDI       Just leave this at 7 if you have more than
' 5. Deletefile   Delete file after move  true/false
' 6. RENAMEFILE   Rename the File         true/false
' 7. BASENAME     Letter at the Front     DSC
'*************************************************
'
'*************************************************
Const StartFrom   = "P:\Photo\NEWCAM"       '==== 1.
Const CopyTo      = "P:\Photo"              '==== 2.
Const EXT_OK      = ",JPG,MPG,"             'comma then EXT then Comma  ie ,JPG,
Const LenEDI      = 7                       'Lenght of the Count String
Const Deletefile  = true                    'Delete files from the StartFrom
Const RENAMEFILE  = False                   'Rename Files
Const BASENAME    = "DSC"                   'leading Letter

'*************************************************
'
'*************************************************
Dim FileCount
Call Start_Read
'*******************************************************************
'
'
'
'*******************************************************************
Sub Start_Read()
    FileCount = 0
    Dim FSO, Folder, SubFolders, Drive
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set Folder = FSO.GetFolder(StartFrom)
    FileCount = FileCount + 1
    Call GenerateFolderInformation(Folder)
    Set FSO = Nothing
    MsgBox "Copy Finish copied " & FileCount & " Files to " & CopyTo
End Sub

Sub GenerateFolderInformation(Folder)
   Dim S
   Dim SubFolders
   Dim SubFolder
   Dim Files
   Dim File
   Dim FileName
   Dim FSO, EXT, TMPyear, MyMonth, TMPMonth, NewFileName
   Dim MYYear
   Set FSO = CreateObject("Scripting.FileSystemObject")
   Set Files = Folder.Files
   If Files.Count <> 0 Then
     For Each File In Files
        EXT = UCase(Right(File.Name, 3))
        If InStr(UCase(EXT_OK), "," & EXT & ",") > 0 Then
        MYYear = Year(File.DateLastModified)
        TMPyear = CopyTo & "\" & MYYear
        If Not FolderExist(TMPyear) Then CreateFolder (TMPyear)
        
        MyMonth = MonthName(Month(File.DateLastModified), True)
        TMPMonth = TMPyear & "\" & MyMonth
        If Not FolderExist(TMPMonth) Then CreateFolder (TMPMonth)
		if RENAMEFILE = true then 
        		NewFileName = TMPMonth & "\" & BaseName & "" & EDITXT(FileCount, LenEDI, "0", True) & "." & EXT
		Else
		        NewFileName = TMPMonth & "\" & File.name
		End if
	'Now Do the Work
            FSO.CopyFile File, NewFileName
            if Deletefile = true then FSO.Deletefile(file)
            FileCount = FileCount + 1
        End If
     Next
   End If
   Set SubFolders = Folder.SubFolders
    If SubFolders.Count <> 0 Then
      For Each SubFolder In SubFolders
         Call GenerateFolderInformation(SubFolder)
      Next
   End If
Set File = Nothing
Set SubFolder = Nothing
End Sub

Function EDITXT(ThisText, Leng, Txt, Leading)
    If Len(ThisText) >= Leng Then
        ThisText = Mid(ThisText, 1, Leng)
    Else
    End If
    If Leading Then
        EDITXT = String(Leng - Len(ThisText), Txt) & ThisText
    Else
        EDITXT = ThisText & String(Leng - Len(ThisText), Txt)
    End If
    If Len(EDITXT) <> Leng Then Stop
End Function

Function FolderExist(FolderName)
    Dim FSO
    Set FSO = CreateObject("Scripting.FileSystemObject")
    If FSO.FolderExists(FolderName) Then
        FolderExist = True
    Else
        FolderExist = False
    End If
End Function

Function CreateFolder(FolderName)
	Dim fs, f
	Set fs = CreateObject("Scripting.FileSystemObject")
	Set f = fs.CreateFolder(FolderName)
	Set f = Nothing
	Set fs = Nothing
End Function

 

Injoy

I see the new TV have USB Plug in them now,

Why did I put rename in the script
because the wife start rename them and even they are in differance folders could have the same name twice because the my mark 1 dig frame could only handle a fileing system 2 folders deap
it put leading 0 so that the photo are Display in the rigth order. 

Please comment.....

or download this file

SortPhoto.txt (4.05 kb)

just rename to a .vbs and change the Const bit to your setting

 

 

 

 

 


1becarefull with this as it will delete the file

Comments

8/5/2010 3:47:46 PM #

MYLE

I have to version of it one setup to copy to my Dig frame and the other copys to my Photo folder

MYLE New Zealand |

8/17/2010 2:38:12 AM #

MYLE

Testing this out

MYLE |

8/27/2010 7:43:51 AM #

k pro

I appreciate the time you took to make the site, but look what it has become. Everyone is commenting about unrelated stuff. Let's keep it on topic people.

k pro United States |

8/27/2010 9:55:15 PM #

MYLE

thanks topic People

MYLE |

8/27/2010 10:03:02 PM #

MYLE

I install in a friends computer and chnage the Startfrom and and the Copyto run it 1 hour later yes a bucket load of image was very happy with as it put all photos in Years the months he found photos he had forgotten about

MYLE |

10/6/2010 10:40:47 PM #

StePhan McKillen

Just use this script to do my Mum 4gb stick now when she plug it into her tv
years months then the photos even she has found photo she had for gotten about

StePhan McKillen New Zealand |

10/10/2010 6:48:13 PM #

art insurance directory

It sounds like you're creating problems yourself by trying to solve this issue instead of looking at why their is a problem in the first place.

art insurance directory Jordan |

3/11/2011 7:43:26 AM #

Myle

So with that reply you must a ......

Myle New Zealand |

11/1/2010 2:37:42 AM #

Victoria

I'm sorry, but I can not agree with that.

Victoria United States |

11/5/2010 9:05:11 PM #

Donn Matuszak

Hi, with the abundance of crappy blogs around it's great to see that there are still some filled with fantastic information! Is there any way I can be emailed when you create a new post? thanks!

Donn Matuszak United States |

12/3/2010 3:58:27 PM #

submersible pump

Is this a blog? Where did you get the theme from?

submersible pump United States |

12/7/2010 8:16:01 AM #

website design

Wow. This site is cool! How can I  make it look this good ?

website design United States |

12/9/2010 9:41:41 AM #

comprare oro

By insisting on the prosecution of Julian Assange, politicians have only risked bumping him to cult hero status.

comprare oro United States |

12/16/2010 8:44:53 AM #

Economic Articles

Can you tell me an example source for this article?

Economic Articles United States |

1/17/2011 7:12:26 PM #

Berenice Kopko

In any kitchen or bedroom a large proportion of the cost is in the cabinetry. If yours are in good condition but you want a new look just simply change the exterior. Why throw away perfectly good cupboards and wardrobes when you don´t have to; especially when you consider we rarely take notice of the inside colour of our cupboards and wardrobes?

Berenice Kopko United States |

Comments are closed

Dislexia

I see people have commented about my style of writting.
Well I have dislexia so spelling is not one of my good points
but when it comes to reading/written code thats the easy bit.

 

 

Poll

What Search Engine Do you use




Show Results

Disclaimer of Liability

While every effort will be made to ensure that the information contained within this website is accurate and up to date, The Company's listed with this web site and any associated parties, make no warranty, representation or undertaking, whether expressed or implied, nor does it assume any legal liability, whether direct or indirect, or responsibility for the accuracy, completeness, or usefulness of any information.

 

Google Ads

Most comments

apply cash advance apply cash advance
1 comments
us United States
cloudy cloudy
1 comments
us United States
mutuelle mutuelle
1 comments
fr France

RecentComments

Comment RSS