Renaming files problem

Domski

Well-known Member
Joined
Jan 18, 2005
Messages
7,292
Hi,

Not much to do with Excel although I have considered a VBA routine to achieve this but am sure it's beyond my skills.

I recently went on a nice long hol to New Zealand and took a heck of a lot of photos. Unfortunately on returning I found that the memory cards that I'd bought appear to have been degrading in the past and I was only able to retrieve a few hundred images.

£20 later and a lot of 'low level scanning' using the software I bought and I've got 3 folders all containing the images I've recovered off each of the 3 cards (about 1500 in total)

The problem I've got is I would like to combine all these files into one folder with the original files I downloaded successfully but the recovery software in each case named the files 'Recovered file 1', 'Recovered file 2', 'Recovered file 3' etc in no particualr chronological order whatsoever.

I therefore need to work out how I can take the files from each of these folders, sort them by the date and time the picture was taken and then rename them 'Photo 1', 'Photo 2', 'Photo 3' etc

Can anyone think of an easy way to achieve this or am I going to have to do it by hand?

Cheers,

Dom
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Cheers, I'll have a go on my PC at home.

Am trying a VBA solution but mostly pulling my hair out.
 
I have used a bit of code on Excel whic lists the files in a directory, with the full file name and date modified.

Maybe you could use this code to get the file names into an Excel sheet and sort them in date order, you could then create unique names for each one in Excel, but you will then need to write some extra VBA to rename the files with the new names.

The code is as follows :-

Code:
Sub DirList()

'Collect names of files in stated directory

Dim fs, d, ff, fx
Dim iRow As Integer
Dim rng As Range
 
Sheets("Listing").Visible = True

  Sheets("Listing").Select
  Cells.Select
  Selection.ClearContents
  Range("A1").Select

  iRow = 0
  Set fs = CreateObject("Scripting.FileSystemObject")
  Set d = fs.getfolder(Range("Directory"))
  
  iRow = iRow + 1
  
  Set ff = d.Files
  For Each fx In ff
    Cells(iRow, 1).Formula = fx.Name
    Cells(iRow, 2).Formula = fx.Size
    Cells(iRow, 3).Formula = fx.datecreated
    Cells(iRow, 4).Formula = fx.datelastaccessed
    Cells(iRow, 5).Formula = fx.datelastmodified
    iRow = iRow + 1
  Next fx

lastcell = Sheets("Setup").Range("ListCount")

Set rng = Range("A1", "A" & lastcell)
rng.Name = "myList"
  
Sheets("Setup").Select
Range("Setup_Menu").Select

Sheets("Listing").Visible = False

End Sub

You'll need to amend the code to suit your purposes, but will this help you get started ?
 
Certainly in winxp you can select all the file sin a folder, right-click and choose rename and it will rename them all with that word and number them. So long as you used a different name in each folder you could then combine them into one folder and repeat the process again to have them all ordered in the one folder.

Hope that makes sense!

Nick
 
Certainly in winxp you can select all the file sin a folder, right-click and choose rename and it will rename them all with that word and number them. So long as you used a different name in each folder you could then combine them into one folder and repeat the process again to have them all ordered in the one folder.

Hope that makes sense!

Nick

So simple but I would never have thought of that!!!
 

Forum statistics

Threads
1,222,710
Messages
6,167,784
Members
452,141
Latest member
beraned1218

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top