Jump to content



Photo

Renaming Files Across Different Folders


  • Please log in to reply
15 replies to this topic

#1 Zoom7000

Zoom7000

    The Ankle Breaker

  • Joined: 12-November 03
  • Location: London, UK
  • OS: Windows 8.1/OS X 10.9
  • Phone: iPhone 4

Posted 09 June 2014 - 15:18

Over the years, I have amassed several 1000s of photos that I have backed up from my iPhone. If memory serves me correctly iOS names them IMG_0001.jpg, IMG_0002.jpg, IMG_0003.jpg etc etc. Now, whenever I have updated my iOS I have always started afresh without restoring from backup. So, I would manually copy my photos over to my PC. This would mean that iOS would name my pictures starting from IMG_0001.jpg again. I have several 1000s of photos in folders across a folder struct like below:

C:\Other Files\Photos...
\2010
\2011
\2012
\2013
\2014

I'd like to get these images all in to one folder "C:\Other Files\Photos"

Would it be possible to do a script that would take the photos in folder 2010 and assuming there were 567 photos in that folder rename them to "0001.jpg", "0002.jpg" ... "0567.jpg" and then move on to 2011 and start from "0568.jpg" and so on for the whole folder structure? This is so that I can have all my photos in one folder, without fear of overwriting duplicates and so that I can copy them back to my iPhone Camera Roll and have them in dated order, with the newly taken photos starting at the end of the camera roll after the older ones.




#2 Jason S.

Jason S.

    Neowinian Senior

  • Tech Issues Solved: 5
  • Joined: 01-September 03
  • Location: Cleveland, Ohio

Posted 09 June 2014 - 15:22

im sure this is possible, but im no programmer. more pressing, though, is wouldnt you want to keep them in a year format instead of just a number? dont you want to remember when that particular photo was taken?

 

are these just random photos? i like to organize mine into a particular event like 'someone's wedding' or 'whatever vacation'.



#3 OP Zoom7000

Zoom7000

    The Ankle Breaker

  • Joined: 12-November 03
  • Location: London, UK
  • OS: Windows 8.1/OS X 10.9
  • Phone: iPhone 4

Posted 09 June 2014 - 16:32

im sure this is possible, but im no programmer. more pressing, though, is wouldnt you want to keep them in a year format instead of just a number? dont you want to remember when that particular photo was taken?

 

are these just random photos? i like to organize mine into a particular event like 'someone's wedding' or 'whatever vacation'.

They're just random photos I've taken on a day to day basis. Nothing is organised in an event. The reason I want to rename the files is because I want them all in my camera roll. Just one big camera roll.



#4 Top Qat

Top Qat

    Neowinian

  • Tech Issues Solved: 8
  • Joined: 09-July 04
  • Location: London, UK
  • OS: Windows 8.1u1 and Server 2012 R2u1
  • Phone: Samsung Galaxy S 3

Posted 09 June 2014 - 19:31

Time to exercise my AutoIT skills.

Attached Images

  • Challenge_Accepted_meme-s360x270-141425.jpg


#5 EZRecovery

EZRecovery

    Puertorican Neowinian Member

  • Joined: 21-November 03
  • Location: Somewhere in the US

Posted 09 June 2014 - 19:49

Perhaps Rename Master would do the job for you!

 

A+Freeware.com - different apps to chose from.



#6 sc302

sc302

    Neowinian Senior

  • Tech Issues Solved: 25
  • Joined: 12-July 05
  • Location: NJ, USA

Posted 09 June 2014 - 20:13

http://www.howtogeek...multiple-files/



#7 Jeff Peters

Jeff Peters

    Resident One Post Wonder

  • Joined: 09-June 14

Posted 09 June 2014 - 20:19

You could do this in powershell:

 

$count = [int]0;dir -recurse C:\Other Files\Photos *.jpg | foreach-object {Copy-Item -Path $_.FullName -Destination "c:\temp\$($count.ToString() + '.jpg')"; $count++}



#8 episode

episode

    Neowinian Fanatic

  • Tech Issues Solved: 3
  • Joined: 11-December 01

Posted 09 June 2014 - 20:29

They're just random photos I've taken on a day to day basis. Nothing is organised in an event. The reason I want to rename the files is because I want them all in my camera roll. Just one big camera roll.

 

Right, but wouldn't you want say '2011_0001.jpg' instead of just '0001.jpg'?



#9 OP Zoom7000

Zoom7000

    The Ankle Breaker

  • Joined: 12-November 03
  • Location: London, UK
  • OS: Windows 8.1/OS X 10.9
  • Phone: iPhone 4

Posted 10 June 2014 - 08:14

Right, but wouldn't you want say '2011_0001.jpg' instead of just '0001.jpg'?

That sounds like a good idea.

 

You could do this in powershell:

 

$count = [int]0;dir -recurse C:\Other Files\Photos *.jpg | foreach-object {Copy-Item -Path $_.FullName -Destination "c:\temp\$($count.ToString() + '.jpg')"; $count++}

Thanks, I'll give that a try and see how it goes! Bit of a n00b question. But how do I run a PS script in a batch file? I know with batch scripts it's .bat and double click, but how do I do that with PowerShell?



#10 Eric

Eric

    Neowinian Senior

  • Tech Issues Solved: 12
  • Joined: 02-August 06
  • Location: Greenville, SC

Posted 10 June 2014 - 20:56

That sounds like a good idea.

 

Thanks, I'll give that a try and see how it goes! Bit of a n00b question. But how do I run a PS script in a batch file? I know with batch scripts it's .bat and double click, but how do I do that with PowerShell?

 

Use ".ps1" for the file extension.



#11 Top Qat

Top Qat

    Neowinian

  • Tech Issues Solved: 8
  • Joined: 09-July 04
  • Location: London, UK
  • OS: Windows 8.1u1 and Server 2012 R2u1
  • Phone: Samsung Galaxy S 3

Posted 10 June 2014 - 21:10

The PowerShell solution looks pretty good, I will abandon my AutoIT efforts.

 

PowerShell looks very interesting. I really must learn about it.

You know of any decent online tutorials/reference I can use? Thanks.



#12 zhangm

zhangm

    Just bitter.

  • Tech Issues Solved: 13
  • Joined: 21-August 02

Posted 10 June 2014 - 22:43

The PowerShell solution looks pretty good, I will abandon my AutoIT efforts.

 

PowerShell looks very interesting. I really must learn about it.

You know of any decent online tutorials/reference I can use? Thanks.

 

Whenever I write a shell script, I'm usually always trying to do something specific rather than just learn for the sake of learning, and I've found that web searches are generally very helpful with examples. It's not uncommon that results from this blog pop up:

 

http://blogs.technet...eyscriptingguy/

 

Also, Powershell itself includes a pretty comprehensive manual (type get-help <COMMAND> or use the man alias).



#13 OP Zoom7000

Zoom7000

    The Ankle Breaker

  • Joined: 12-November 03
  • Location: London, UK
  • OS: Windows 8.1/OS X 10.9
  • Phone: iPhone 4

Posted 11 June 2014 - 14:09

I tried running the PowerShell command and I got this error:

Get-ChildItem : A positional parameter cannot be found that accepts argument '*.jpg'.
At line:1 char:20
+ $count = [int]0;dir <<<<  -recurse C:\Other Files\Photos *.jpg | foreach-object {Copy-Item -Path $_.FullName -Destination "c:\temp\$($count.ToString() + '.jpg')"; $count++}
    + CategoryInfo          : InvalidArgument: (:) [Get-ChildItem], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

Any ideas?

 

EDIT: Found the problem. It was caused by missing quotes around "C:\Other Files\Photos"

 

That script copied the photos to C:\Temp, but it renamed the files "1.jpg", "2.jpg", "3.jpg" etc. Is there anyway I can get the numbering to "0001.jpg", "0002.jpg", "0003.jpg" etc.



#14 spikey_richie

spikey_richie

    XXXIII

  • Tech Issues Solved: 5
  • Joined: 02-February 05
  • Location: Nuneaton, UK
  • OS: Windows 8.1u1 Pro 64-bit
  • Phone: Sony Xperia Z1

Posted 11 June 2014 - 14:23

You've probably sorted this by now, but some time ago there was a tool listed on here https://twitter.com/sourceforge which I used very successfully. Problem is, I can't remember the name of it now :(

 

This might be useful too

 

http://sourceforge.n...cently-updated/



#15 zhangm

zhangm

    Just bitter.

  • Tech Issues Solved: 13
  • Joined: 21-August 02

Posted 11 June 2014 - 15:46

That script copied the photos to C:\Temp, but it renamed the files "1.jpg", "2.jpg", "3.jpg" etc. Is there anyway I can get the numbering to "0001.jpg", "0002.jpg", "0003.jpg" etc.

 

$count = [int]0;dir -recurse C:\src\tmp *.jpg | foreach-object {Copy-Item -Path $_.FullName -Destination "c:\src\out\$($count.ToString().PadLeft(4, '0') + '.jpg')"; $count++}