1
\$\begingroup\$

I'm trying to organize my photographs by day of week and time of day taken.

For example, if I have a math class from 10:00AM-12:00PM every Monday and Wednesday, I want to move photos taken in that time range to one folder?

Somewhat related to this question, but day of week specific, not month of year specific.

I've come across some powershell related questions, but I don't see how to modify them to include day of week.

Please help.

\$\endgroup\$
7
  • \$\begingroup\$ do you have any digital asset management software ( lightroom, adobe bridge etc ) ? More info is needed. \$\endgroup\$
    – Alaska Man
    Commented Mar 5, 2018 at 1:03
  • \$\begingroup\$ If these softwares have functionalities which can perform these tasks then I'd get them. I'm running Windows 10 \$\endgroup\$
    – wizlog
    Commented Mar 5, 2018 at 1:10
  • \$\begingroup\$ I'm voting to close this question as off-topic because this is a general computing question. Change "photos" to "documents" and the answer would be the same. \$\endgroup\$
    – Caleb
    Commented Mar 5, 2018 at 12:08
  • \$\begingroup\$ @caleb, documents don't have a "date taken" field, if they did, I would just use Excel. \$\endgroup\$
    – wizlog
    Commented Mar 5, 2018 at 17:03
  • \$\begingroup\$ @wizlog. I use adobe bridge. i can set it to display the photos in the order by date that they were taken. I can look at the meta data and see the time each photo was taken. I can then choose all the photos between two specific times and right click on them and choose "move to" option in a drop down menu and move all of them to any folder i want. you can label that folder with the time period of the photos with the date taken so that folders will be stored in chronological order. It not a automatic script but it does not involve the time need to write a script. \$\endgroup\$
    – Alaska Man
    Commented Mar 5, 2018 at 18:37

1 Answer 1

1
\$\begingroup\$

To use one of the already created answers in PowerShell

<#
File modified by Joshua as taken from
http://www.marcvalk.net/2012/06/powershell-moving-files-into-subfolder-based-on-date/

Set Variables of Source folder and Destination folder
Assign variable of files to be the files with uss extension
For each file with uss extension assign the Directory variable the information for file creation year and month
    if the year and month folder do not exist, then create them from file creation information
Move file to sub-folder of year and month from file creation information passed into Directory variable

#>

$SourceDir = "C:\<Pointer>"
$DestinationDir = "C:\<Pointer>"

$files = get-childitem $SourceDir 

foreach ($file in $files) 

{

$Directory = $DestinationDir + "" + $file.CreationTime.Date.ToString('yyyy') + "\" + $file.CreationTime.Date.ToString('MM-MMM') + "\" + $file.CreationTime.Date.ToString('DD')

if (!(Test-Path $Directory))
{
New-Item $directory -type directory
}
Move-Item $file.fullname $Directory 
}

do note that you'll need to point to your folder before hand, basically when you're in type "cd c:\" with the pointer being where the folder is

Make sure to edit $SourceDir = "C:\<Pointer>" and $DestinationDir = "C:\<Pointer>" as needed

The other option is this

    $Folder = "C:\<pointer>"

    get-childitem | % {

    $file = $_.FullName 
    $date = Get-Date ($_.CreationTime)
    $hour = $date.Hour
    $day = $date.day
    $month = $date.month
    $year = $date.year

    new-item -type Directory -path "$Folder\$year\$month\$day\$hour"
    move-item $file "$Folder\$year\$month\$day\$hour"
}

However, all these solutions require you to run the script at the time you want to log your files.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks, but where do I specify Wednesdays between 10 am and 12 pm? \$\endgroup\$
    – wizlog
    Commented Mar 5, 2018 at 17:02
  • \$\begingroup\$ That's as far as it goes if you want to do more you'd need to create your own code. \$\endgroup\$
    – Matthew
    Commented Mar 5, 2018 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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