Sign in to follow this  

Renaming Files Across Different Folders

Recommended Posts

Zoom7000    148

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.

Share this post


Link to post
Share on other sites
Jason S.    1,243

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'.

Share this post


Link to post
Share on other sites
Zoom7000    148

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.

Share this post


Link to post
Share on other sites
Top Qat    193

Time to exercise my AutoIT skills.

post-61951-0-59321100-1402342276.jpg

Share this post


Link to post
Share on other sites
EZRecovery    7

Perhaps Rename Master would do the job for you!

 

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

Share this post


Link to post
Share on other sites
Jeff Peters    2

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++}

  • Like 2

Share this post


Link to post
Share on other sites
episode    568

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'?

  • Like 1

Share this post


Link to post
Share on other sites
Zoom7000    148

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?

Share this post


Link to post
Share on other sites
Eric    1,514

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.

  • Like 1

Share this post


Link to post
Share on other sites
Top Qat    193

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.

Share this post


Link to post
Share on other sites
zhangm    1,190

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.com/b/heyscriptingguy/

 

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

Share this post


Link to post
Share on other sites
Zoom7000    148

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.

Share this post


Link to post
Share on other sites
spikey_richie    173

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.net/directory/system/storage/file-management/os:windows/freshness:recently-updated/

Share this post


Link to post
Share on other sites
zhangm    1,190

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++} 

Share this post


Link to post
Share on other sites
spikey_richie    173

Found the tool I was looking for the other day... http://www.dropitproject.com/

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.