Open mucst opened 1 year ago
--use-hardlinks will use hardlinks instead of symlinks
I'm not convinced these will help though. If you are using Windows I say to enable symlinks or not sync albums. So unless you can support some kind of links in your FS I don't think gphotos-sync will work for albums.
I just checked in the code and it looks like using --album MyAlbumName --skip-albums will:
@mucst does the above work for your use case?
Hey @gilesknap , thanks for the reply.
I don't think hard links could ever help since windows does not have anything similar.
As a first quick solution, I "patched" the script by replacing line 436 with a pass
(custom Dockerfile FROM
your image). Later on however I reformatted my HDD with ext4 filesystem ( I had other issues not related to this project).
Now I tried the solution that you suggested (with non-patched Main.py
). Unfortunately the --skip-albums
did not do the trick because links were eventually created.
The situation in my opinion is:
--skip-albums
is unclear to me at least). os.symlink(...)
. Perhaps as first quick fix, if target FS is ntfs-like then skip link creation altogether. Same if OS is windows (because on windows there is no scenario where would ever write to an ext FS that supports symlinks or hard links.So on my part this issue is solved, however as project owner you gotta decide how you tackle the above issues, if you want to in the first place.
Final thought: with current lineup, how can this application run on Windows (if not containerized)? 🤔 Because as I said, according to google shortcuts are not created with a plain os.symlink(...)
there.
PS. Because I am lazy to experiment or research properly, I asked ChatGPT:
What happens if in python I call os.symlink on a Windows machine?
Answer: If you call os.symlink() on a Windows machine running Python, it will most likely raise a NotImplementedError exception, as symbolic links are not fully supported on Windows.
Windows does support a type of symbolic link called "junction points", but they have different semantics than Unix-style symbolic links, and they are not created using the os.symlink() method. Instead, you can create junction points using the os.system() method to run the mklink command from the Windows command prompt.
Here's an example of creating a junction point using mklink:
import os
target = "C:\\Users\\UserName\\Documents\\target_folder"
link = "C:\\Users\\UserName\\Desktop\\link_name"
os.system('mklink /J "{}" "{}"'.format(link, target))
In the example above, target
is the folder you want to link to, and link
is the path of the junction point you want to create. The /J
flag indicates that you want to create a junction point. You'll need to replace UserName
with your actual Windows user name.
Thanks for the detailed report.
The intention of skip-albums
is entirely not creating symlinks. So either it's completely broken or using --album with it causes an issue.
Re symlinks on Windows. I do have windows users of this tool and it does work if you enable symlinks in the policy manager as documented here https://gilesknap.github.io/gphotos-sync/main/how-to/windows.html#symlinks. Also the CI tests in Github actions run against a WIndows VM (but I don't know for sure that it uses NTFS).
I assume therefore that os.symlink does work on modern Windows versions at least. Can't remember the journey to make this tool work on Windows but I did testing on my linux/Windows dual boot.
Right. I'm surprised about the ability to enable symlinks on windows, but that explains. I'm sure that the VMs run NTFS or alike filesystem because windows does not support ext fs of any kind. But ok, let's leave it at that. Thanks for the clarification.
leaving this open - TODO look at behaviour of --skip-albums with and without --album
I'm running the application in docker (today's latest version: 3.1.2), git revision a631449f252f624b8109f3134620d3a412b543d7. Host Device is a Raspberry PI 2, attached an exFat filesystem external HDD. When I try to run the application, it fails with:
Apparently it tried to create a symlink on the storage which failed. Is there a chance to avoid this error by for example omitting symlink creation? I don't need it for my usecase anyway. I however want to synchronize a specific album.