drive icon indicating copy to clipboard operation
drive copied to clipboard

Is there any way to preserve symlinks rather than copying the data?

Open nathanbrauer opened this issue 9 years ago • 2 comments

Example:

cd Drive
echo "Hello world!" > test.txt
drive push test.txt

ln -s test.txt link.txt
drive push link.txt

# Viewing files in the web app shows both are identical

echo "My name is Nathan!" >> test.txt
drive push test.txt

# Viewing files in the web app shows both are NOT identical

nathanbrauer avatar Apr 23 '16 06:04 nathanbrauer

Hello @nathanbrauer, thank you for the question and welcome to drive!

Unfortunately there isn't a way to preserve symlinks remotely so far. So, files on the remote don't have any concept of symlinks nor any relation to the local ones except just by sharing the same path relative to the root. The same thing applies for local file system specific attributes such as file permissions, these can't be preserved easily.

On the bright side though, if want to support this mode, we can use the DB locally to store symlink info and then meta data storage https://developers.google.com/drive/v3/web/properties remotely on Google Drive. A little bit complex and theoretical, sure but I think it could work, I've used meta data storage on another Google Drive backed project (but not for this purpose) and it worked alright.

link.txt and test.txt are different entities remotely which you can verify by

$ drive id test.txt link.txt

that should show you distinct file Ids which is the crux of the problem without having to do any extra work to mark relationships between files.

IMO this case is quite complex since as mentioned previously symlink info is not easily preserved remotely. Please let me know what you think or any suggestions, corrections or ideas. It would be a nice feature to have.

odeke-em avatar Apr 23 '16 09:04 odeke-em

@odeke-em in google drive there are now shortcuts available. This looks like symlinks for drive. Maybe we can implement this? https://developers.google.com/drive/api/guides/shortcuts

Buntelrus avatar May 29 '23 20:05 Buntelrus