TheLastGimbus / GooglePhotosTakeoutHelper

Script that organizes the Google Takeout archive into one big chronological folder
https://aur.archlinux.org/packages/gpth-bin
Apache License 2.0
3.48k stars 176 forks source link

Invalid cross-device link #202

Closed jonathon2nd closed 1 year ago

jonathon2nd commented 1 year ago

Hello!

I am attempting to run v3.4.1 with input being local, and remote being a mount to my nas.

If this fixable, or will a mount to network nas not work?

Moving photos to output folder : ........................................ 0/27155  Unhandled exception:
FileSystemException: Cannot rename file to '/mnt/nas/New-Takeout/ALL_PHOTOS/August 9th. (14).AVI', path = '/home/user/Downloads/Takeout/Google Photos/Photos from 2010/August 9th. (14).AVI' (OS Error: Invalid cross-device link, errno = 18)
#0      _checkForErrorResponse (dart:io/common.dart:42)
#1      _File.rename.<anonymous closure> (dart:io/file_impl.dart:318)
<asynchronous suspension>
#2      moveFiles.moveFile (package:gpth/moving.dart:132)
<asynchronous suspension>
#3      moveFiles (package:gpth/moving.dart:137)
<asynchronous suspension>
#4      main.<anonymous closure> (file:///home/runner/work/GooglePhotosTakeoutHelper/GooglePhotosTakeoutHelper/bin/gpth.dart:365)
<asynchronous suspension>
palijn commented 1 year ago

GPTH by default attempts to move files, which is always going to be a problem across filesystems, which is your situation since your target is a different mount. You should try the --copy option.

palijn commented 1 year ago

I should add that all implementations of move across filesystems solve the issue by effecting a copy followed by a delete of the original. In the --copy case you're just left with deleting the originals yourself. (I really don't know if Dart would have a specific call for that.)

jonathon2nd commented 1 year ago

OK, now that I know that I just ran it all on local.

$ ./gpth-linux --input Takeout/ --output New-Takeout/
Okay, running... searching for everything in input folder...
Finding duplicates...
Guessing dates from files : █████................................... 3552/27155  
Can't get date on Takeout/Google Photos/Photos from 2016/unspecified(1).jpg
Guessing dates from files : ████████................................ 5500/27155  
Can't get date on Takeout/Google Photos/Photos from 2016/unspecified.jpg
Guessing dates from files : ████████................................ 5854/27155  
Can't get date on Takeout/Google Photos/Photos from 2016/Haha.jpg
Guessing dates from files : ███████████████████████████████████████. 27152/27155  
Finding albums...
Moving photos to output folder : ████████████████████████████████████████ 27155/27155  
========================================
DONE! FREEEEEDOOOOM!!!
Skipped 6 duplicates
Couldn't find date for 3 photos/videos :/

Last thing - I've spent *a ton* of time on this script - 
if I saved your time and you want to say thanks, you can send me a tip:
https://www.paypal.me/TheLastGimbus
https://ko-fi.com/thelastgimbus
Thank you ❤
========================================

I still see things in Takeout that are not in New-Takeout. Looks to be just videos.

$ du -h --max-depth=1 .
208G    ./New-Takeout
158G    ./Takeout

What should I do next?

EDIT: I am guessing move New-Takeout into Takeout, and overwrite all files. Yeah that did what I wanted,

Thanks!

TheLastGimbus commented 1 year ago

oh big thanks @palijn for help!

yes indeed the move could be a problem

I still see things in Takeout that are not in New-Takeout. Looks to be just videos.

this is good - gpth is smart and doesn't copy duplicates etc

if you have a takeout with "year photos" and albums, those two contain identical copied files - gpth copies only one if required (depending on what album solution you chose)

What should I do next?

umm, nothing :shrug: - the New-Takeout/ folder contains everything you want, and you can delete the input folder as it is messy now (some files where moved and some where not)

just keep the original zips in any case