Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

All my mobile device's photos and videos are backed up to the cloud and synchronized to my laptop using Dropbox's "Camera Upload" feature. All the photos and videos get added to the "camera uploads" folder in the Dropbox folder.

I am wanting to move all of these to my Photos and Videos folders within my user folder. I am using Windows 8 but this question could also be for Windows 7.

Ideally I want photos moved to the My Pictures folder. The photo should be in a folder named the date and that folder should be in a folder named as the year. For example, if a photo was taken on October 4, 2013 it should be in My Pictures/2013/2013-10-04/

The photo itself should be renamed to the date and time the photo was taken and optionally followed by the original filename. For example if a photo was taken at 14:05:07 on October 4, 2013 and was called IMG003.jpg it would be in My Pictures/2013/2013-10-04/2013-10-04 14.05.07 IMG003.jpg

Videos would work the same but would be put in the My Videos folder. For example, a video taken at 17:03:01 on October 1, 2013 would be moved to My Videos/2013/2013-10-01/2013-10-01 17.03.01 VIDEO003.mpg

Is there an app that I could use to automate this process or could it be done using a batch file?

share|improve this question

1 Answer 1

Assuming you use Windows 7/8 where Powershell is preinstalled.

This Powershell script copies files from a source folder ($source) to a destination folder ($dest).
You filter for your desired files with $filter array, e.g only pictures or videos.

  • New folder is changed to <destination_folder\old_subfolders\YYYY\YYYY-MM-DD>
  • New file name is changed to <YYYY-MM-DD hh.mm.ss oldfilename.extension>

Every line is commented and I haven't used aliases on purpose.

### set input folder
$source = "C:\My Dropbox\Camera Uploads"      

### set output folder
$dest = "C:\Users\<USERNAME>\My Pictures"

### set which file types to include/copy
$filter = @("*.png", "*.jpg", "*.jpeg")

### retrieve all files from source folder and pipe them to copy 
Get-ChildItem $source -include $filter -recurse | foreach {         

    ### build new destination folder string (syntax: destination folder + old subfolders + year + year-month-day)
    $destSub = $_.directoryname.Replace($source, $dest +'\'+ $_.CreationTime.Year +'\'+ $_.CreationTime.ToString("yyyy-MM-dd"))        
    $destSub

    ### check if new destination folder exists, otherwiese create new subfolder(s)
    if (-not (Test-Path -literalpath $destSub)) { New-Item $destSub -Type Directory }    

    ### build new file name string (syntax: new destination folder + year-month-date hours.minutes.seconds + oldname.extension)
    $destName = $destSub +'\'+ $_.CreationTime.ToString("yyyy-MM-dd hh.mm.ss") + ' ' + $_.name    
    $destName

    ### copy source file to new file name
    copy-item -literalpath $_.Fullname -destination $destName
    }

First, test the script with copy-item command. Later you can replace copy-item with move-item.

share|improve this answer
    
Thanks for this. I've tried this but can't get it to work. The first issue was that Powershell wasn't allowing the script. Once I sorted it, it seemed to run but did nothing. I'll try again later once I have a bit more time. Would there be any reason why the script would look like it was running and not throw any error messages but not actually do anything? –  iagdotme Oct 4 '13 at 16:47
    
I added two lines for better debugging ($destSub and $destName). Look carefully if they are build up correctly. Pay attention to [, ] and \ characters. Set up a simple test case on your desktop with 2 or three files –  nixda Oct 4 '13 at 16:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.