Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why doesn't it move the newest file? #156

Open
y8s opened this issue Apr 25, 2023 · 3 comments
Open

why doesn't it move the newest file? #156

y8s opened this issue Apr 25, 2023 · 3 comments

Comments

@y8s
Copy link

y8s commented Apr 25, 2023

I have one file created today but sortphotos.py doesn't see it as having a valid date. Is there a newness limit to what it considers?

See file [1/3] below:

C:\OneDrive\Pictures\Screenshots> python.exe c:\onedrive\Projects\sortphotos\src\sortphotos.py . .
Preprocessing with ExifTool.  May take a while for a large number of files.
    1 directories scanned
    3 image files read
[{
  "SourceFile": "./2023-04-25.png",
  "File:FileModifyDate": "2023:04:25 14:47:02-04:00",
  "File:FileAccessDate": "2023:04:25 15:16:03-04:00",
  "File:FileCreateDate": "2023:04:25 14:47:02-04:00"
},
{
  "SourceFile": "./Screenshot 2013-10-30 19.31.40.png",
  "File:FileModifyDate": "2013:10:30 19:31:40-04:00",
  "File:FileAccessDate": "2023:04:25 15:16:03-04:00",
  "File:FileCreateDate": "2018:09:18 09:52:04-04:00"
},
{
  "SourceFile": "./Screenshot 2013-10-30 19.31.55.png",
  "File:FileModifyDate": "2013:10:30 19:31:55-04:00",
  "File:FileAccessDate": "2023:04:25 15:16:03-04:00",
  "File:FileCreateDate": "2018:09:18 09:52:04-04:00"
}]
{ready}

[1/3]
Source: ./2023-04-25.png
No valid dates were found using the specified tags.  File will remain where it is.

[2/3]
Source: ./Screenshot 2013-10-30 19.31.40.png
Date/Time: 2013-10-30 23:31:40
Corresponding Tags: File:FileModifyDate
Destination (move): .\2013\10-Oct\Screenshot 2013-10-30 19.31.40.png

[3/3]
Source: ./Screenshot 2013-10-30 19.31.55.png
Date/Time: 2013-10-30 23:31:55
Corresponding Tags: File:FileModifyDate
Destination (move): .\2013\10-Oct\Screenshot 2013-10-30 19.31.55.png

Also on a related note, is there a way to make the script ignore files less than 30 days old? I'd like to keep the newest 30 days of files in the root folder and only move older files.

@matthiasbalke
Copy link

Can you validate if this is only happening when using png files? You may try a picture taken today in jpg format.

@y8s
Copy link
Author

y8s commented Apr 26, 2023

I take a lot of screenshots (they are usually png) but I put a jpg in that folder this morning and tested:

C:\OneDrive\Pictures\Screenshots> python.exe c:\onedrive\Projects\sortphotos\src\sortphotos.py c:\onedrive\Pictures\Screenshots c:\OneDrive\Pictures\Screenshots
Preprocessing with ExifTool.  May take a while for a large number of files.
    1 directories scanned
    4 image files read
[{
  "SourceFile": "c:/onedrive/Pictures/Screenshots/2023-04-25 (2).png",
  "File:FileModifyDate": "2023:04:25 16:36:33-04:00",
  "File:FileAccessDate": "2023:04:26 09:11:51-04:00",
  "File:FileCreateDate": "2023:04:26 09:11:37-04:00"
},
{
  "SourceFile": "c:/onedrive/Pictures/Screenshots/2023-04-25.png",
  "File:FileModifyDate": "2023:04:25 14:47:02-04:00",
  "File:FileAccessDate": "2023:04:26 09:11:51-04:00",
  "File:FileCreateDate": "2023:04:26 09:11:37-04:00"
},
{
  "SourceFile": "c:/onedrive/Pictures/Screenshots/2023-04-26.png",
  "File:FileModifyDate": "2023:04:26 09:10:50-04:00",
  "File:FileAccessDate": "2023:04:26 09:11:51-04:00",
  "File:FileCreateDate": "2023:04:26 09:10:50-04:00"
},
{
  "SourceFile": "c:/onedrive/Pictures/Screenshots/PXL_20230426_130657228.MP.jpg",
  "File:FileModifyDate": "2023:04:26 09:07:23-04:00",
  "File:FileAccessDate": "2023:04:26 09:11:51-04:00",
  "File:FileCreateDate": "2023:04:26 09:11:37-04:00",
  "EXIF:ModifyDate": "2023:04:26 09:06:57",
  "EXIF:DateTimeOriginal": "2023:04:26 09:06:57",
  "EXIF:CreateDate": "2023:04:26 09:06:57",
  "EXIF:OffsetTime": "-04:00",
  "EXIF:OffsetTimeOriginal": "-04:00",
  "EXIF:OffsetTimeDigitized": "-04:00",
  "EXIF:SubSecTime": 228,
  "EXIF:SubSecTimeOriginal": 228,
  "EXIF:SubSecTimeDigitized": 228,
  "EXIF:GPSTimeStamp": "13:06:53",
  "EXIF:GPSDateStamp": "2023:04:26",
  "ICC_Profile:ProfileDateTime": "2016:12:08 09:38:28",
  "Composite:GPSDateTime": "2023:04:26 13:06:53Z",
  "Composite:SubSecCreateDate": "2023:04:26 09:06:57.228-04:00",
  "Composite:SubSecDateTimeOriginal": "2023:04:26 09:06:57.228-04:00",
  "Composite:SubSecModifyDate": "2023:04:26 09:06:57.228-04:00"
}]
{ready}

[1/4]
Source: c:/onedrive/Pictures/Screenshots/2023-04-25 (2).png
Date/Time: 2023-04-25 20:36:33
Corresponding Tags: File:FileModifyDate
Destination (move): c:\OneDrive\Pictures\Screenshots\2023\04-Apr\2023-04-25 (2).png

[2/4]
Source: c:/onedrive/Pictures/Screenshots/2023-04-25.png
Date/Time: 2023-04-25 18:47:02
Corresponding Tags: File:FileModifyDate
Destination (move): c:\OneDrive\Pictures\Screenshots\2023\04-Apr\2023-04-25.png

[3/4]
Source: c:/onedrive/Pictures/Screenshots/2023-04-26.png
No valid dates were found using the specified tags.  File will remain where it is.

[4/4]
Source: c:/onedrive/Pictures/Screenshots/PXL_20230426_130657228.MP.jpg
Date/Time: 2023-04-26 09:06:57
Corresponding Tags: EXIF:ModifyDate, EXIF:DateTimeOriginal, EXIF:CreateDate
Destination (move): c:\OneDrive\Pictures\Screenshots\2023\04-Apr\PXL_20230426_130657228.MP.jpg

Here is a JPG and a PNG from this morning as well as the PNG that failed from my previous post and one other PNG from yesterday.

I copied the ones from yesterday into this folder from their post-sort folder (and deleted the ones in the sorted date folder) so the 2023-04-25 (2).png has a create date of April 26 and a modify date of April 25, but it was moved successfully.

@matthiasbalke
Copy link

So that’s what I thought. PNG by it’s standard doesn’t embeds EXIF data, or at least not in a default format. So as the output shows the timestamp used is the File::FileModifyDate. One of your PNG files (2023-04-26.png) does not have a modified date set. So sortphotos can not know how to sort it.

Maybe you created the screenshots using different tools? Or touched them somehow a modified date would sometimes be set?

Further readings on PNG and EXIF: https://stackoverflow.com/a/9576717/520631

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants