简体   繁体   English

在符号链接和文件夹之间自动切换

[英]Automatically Switching Between Symbolic Links and Folders

I currently have my Dropbox saved on an external drive. 我目前将我的Dropbox保存在外部驱动器上。

I'm trying to figure out if at least one of theses two things is possible when I do not have my external drive with me: 我试图找出在没有外部驱动器的情况下,至少有以下两种可能之一:

Can I create some kind of 'switch' so that when my external drive disconnects, the symbolic link automatically become a folder which I can still store my info in like usual, and next time I connect my external drive it will become a symbolic link again and upload the files that I stored while the drive was disconnected? 我可以创建某种“开关”以便当外部驱动器断开连接时,符号链接自动成为一个文件夹,我仍然可以像往常一样存储信息,而下次我连接外部驱动器时,它将再次变为符号链接并上传驱动器断开连接时存储的文件?

Or could I at least have the symbolic link point to a local folder when the drive is disconnected and then point back to the Dropbox folder when the drive is connected while still having the local folder auto-sync to the Dropbox folder? 还是在断开驱动器连接时至少使符号链接指向本地文件夹,然后在连接驱动器时又使指向指向Dropbox文件夹的链接同时仍然使本地文件夹自动同步至Dropbox文件夹?

Thanks! 谢谢!

It should be doable to write a(n eg. bash) script to create and delete the symlink and do the copying (probably via a temp directory). 应该可以编写一个(例如bash)脚本来创建和删除符号链接并进行复制(可能通过temp目录)。
I don't know how to handle the triggering, though. 不过,我不知道如何处理触发。
Brainstorming a bit, you can have a symlink in your dropbox folder that points to some other folder; 稍微想一下,您可以在保管箱文件夹中有一个指向其他文件夹的符号链接。 I do that all the time in order to preserve my organizational structure at home but still have a subset available from elsewhere. 我一直在这样做,目的是保留我的组织结构,但仍然有其他地方可用的子集。
BUT symlinks only work within a single filesystem. 但是符号链接仅在单个文件系统中起作用。 I'm not positive about hardlinks. 我对硬链接不是很满意。
Is your external drive formatted with HFS+? 您的外部驱动器是否已使用HFS +格式化? That could make a difference too. 这也可能有所作为。

I don't fully understand your situation but if you want flexibility with creating symlinks to external drives that may be connected at one point and disconnected at other times, it seems like dropbox is not a good option for that . 我不完全了解您的情况,但是如果您希望灵活地创建到可能在某一点连接而在另一时间断开连接的外部驱动器的符号链接,那么Dropbox似乎不是一个好选择 Prepare for file deletion, as I learned :) 据我了解,准备删除文件:)

I am finding that Google Drive with this Insync app for Linux is achieving the job. 我发现带有适用于Linux的Insync应用程序的Google云端硬盘正在完成这项工作。 We'll see if it continues to. 我们将继续观察它。

EDIT: Dropbox Support told me that indeed dropbox does not support symlinks to external drives which get disconnected. 编辑:Dropbox支持告诉我,的确Dropbox不支持与断开连接的外部驱动器的符号链接。 It results in deleting everything the symlink pointed to. 结果是删除了符号链接指向的所有内容。 Here's their response: 这是他们的回应:


Hi there, 嗨,您好,

I'm Tyler. 我是泰勒 Thanks for contacting Dropbox Support! 感谢您联系Dropbox支持!

Currently, the Dropbox desktop application does not support such a feature on any operating system. 当前,Dropbox桌面应用程序在任何操作系统上均不支持此功能。

Dropbox can be used with an external hard drive as long as you can ensure the drive is always connected to your computer while Dropbox is running. Dropbox可以与外部硬盘驱动器一起使用,只要您可以确保Dropbox在运行时始终将驱动器连接到计算机。 If the drive is ever disconnected from the computer while Dropbox is running there is a small chance that the Dropbox software will start deleting files before realizing that the entire drive has been removed. 如果在Dropbox运行时将驱动器与计算机断开连接,则在意识到整个驱动器已被卸下之前,Dropbox软件将有很小的机会开始删除文件 Also, for Dropbox to work best you should make sure that the drive is formatted as NTFS (Windows), HFS (Mac OS X) or a file system that supports extended attributes (Linux). 另外,为使Dropbox发挥最佳性能,应确保将驱动器格式化为NTFS(Windows),HFS(Mac OS X)或支持扩展属性的文件系统(Linux)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM