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

Can't output files to different drive than input #251

Open
flofly22 opened this issue Oct 1, 2023 · 6 comments · May be fixed by #298
Open

Can't output files to different drive than input #251

flofly22 opened this issue Oct 1, 2023 · 6 comments · May be fixed by #298

Comments

@flofly22
Copy link

flofly22 commented Oct 1, 2023

Hi

I realized that gpth is crashing under windows if the output directory is on a different harddisk volume then the input directory.

@flofly22
Copy link
Author

flofly22 commented Oct 1, 2023

Hi

I posted a bit too fast, here is some error message from the cmd

Moving photos to output folder : ........................................ 0/215 Unhandled exception: FileSystemException: Cannot rename file to 'Y:\Google_Export\takeoutHelper\ALL_PHOTOS\2014\09\IMAG0726(1).jpg', path = 'Z:\15_Export\01_Google Fotos\takeout-20231001T073449Z\Takeout\Google Fotos\Photos from 2014\IMAG0726(1).jpg' (OS Error: The system cannot move the file to a different disk drive. , errno = 17) #0 _checkForErrorResponse (dart:io/common.dart:55) #1 _File.rename.<anonymous closure> (dart:io/file_impl.dart:335) <asynchronous suspension> #2 moveFiles.moveFile (package:gpth/moving.dart:135) <asynchronous suspension> #3 moveFiles (package:gpth/moving.dart:140) <asynchronous suspension> #4 main.<anonymous closure> (file:///d:/a/googlephotostakeouthelper/googlephotostakeouthelper/bin/gpth.dart:373) <asynchronous suspension>

Regards
Florian

@TheLastGimbus
Copy link
Owner

Huuhh.....

Well i see it's a system/programming language error, so i can't do much about it... but you can just run directly on main drive - by default gpth moves the files, so it will use 0 extra space

@eedbarr
Copy link

eedbarr commented Oct 10, 2023

Thank you for linking me to this issue. As a recap, I can save it in the same hard disk since gpth only moves them and not really copy. I will try that when I Get home.

Thank you!

@peter-kraker
Copy link

I'm getting the same error.

Googling the error, it seems like you can only rename files in Dart if they are on the same filesystem. The workaround is to use File.copy instead. You are renaming files using File.rename in moving.dart#135, but the previous line calls File.copy -- the ternary syntax there makes it hard to understand the logic: any way you could detect if the destination is on a different filesystem and call a different function accordingly?

I was not using the tool in the way you intended, but let me walk through my thinking: I assumed that you were copying full files around. I figured that you would leave the pictures in Google Takeout directory and copy the into a new directory. I didn't want to thrash my disk doing that (nor do I have that much free space), so I decided to use different drives for source and target -- I figured one disk would read while the other writes. One additional reason why I wanted to do that was to have a very clear source & destination in case anything went wrong -- I think I would prefer to leave the Google Takeout directory in-place in case I don't like the results of the TakeoutHelper.

Now that I understand that you're not moving the full content of the file, just "renaming" them, I realize that copying "in place" won't thrash the disk. I don't mind proceeding with that workaround, but If something breaks halfway, I'm a bit worried that I will have to start all over, downloading ~250GB of TAR files from Google and extracting them.

@TheLastGimbus
Copy link
Owner

Thanks for you broad case-study 👀

I think I would prefer to leave the Google Takeout directory in-place

You can do this! Just use cmd options and --copy

I will have to start all over, downloading ~250GB

Yeah that error could get messy, but just don't delete the original zips...

huh, but you may not have storage not to delete them.... hmm... well, in that case, coping them would trash as much storage as keeping the original zip so that's a tie 👍

@TheLastGimbus
Copy link
Owner

6ddd94a

🎉

@TheLastGimbus TheLastGimbus changed the title crash when output directory is on different volume Can't output files to different drive than input Dec 4, 2023
@TheLastGimbus TheLastGimbus pinned this issue Feb 6, 2024
@Randomblock1 Randomblock1 linked a pull request Mar 14, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

4 participants