简体   繁体   English

如何将桌面文件夹从“桌面 - 本地”更改为 mac 上的其他文件夹?

[英]How to change the desktop folder from “Desktop - Local” to a different folder on mac?

The files that are displayed on the desktop come from the folder桌面上显示的文件来自文件夹

/Users/USER/Desktop /用户/用户/桌面

I am wondering if there is any way to be able to change that so the files that are displayed on the desktop come from a different folder?我想知道是否有任何方法可以更改它,以便桌面上显示的文件来自不同的文件夹?

The aim behind this is to use Google Drive ( https://www.google.com/drive/download/ ) and create a "Desktop" folder in my Drive account allowing me to sync and access my Desktop from anywhere without using as much storage locally with all the files at the desktop being displayed from这背后的目的是使用 Google Drive ( https://www.google.com/drive/download/ ) 并在我的 Drive 帐户中创建一个“桌面”文件夹,允许我从任何地方同步和访问我的桌面,而无需使用太多本地存储,桌面上的所有文件都显示在

/Users/USER/Google Drive/Mac Desktop /Users/USER/Google Drive/Mac 桌面

Appreciate all the help in advance!提前感谢所有帮助!

Backup your old default Desktop folder备份旧的默认桌面文件夹

If you have files in your existing Desktop folder, don't worry.如果您现有的桌面文件夹中有文件,请不要担心。 We're going to back up your existing folder so you can copy your old Desktop files to your new DropBox Desktop folder afterwards.我们将备份您现有的文件夹,以便您之后可以将旧的桌面文件复制到新的 DropBox 桌面文件夹。

Simply open a terminal and enter the following command.只需打开一个终端并输入以下命令。

sudo mv desktop desktop.bak

Create a symbolic link to your new DropBox Desktop folder创建指向新 DropBox 桌面文件夹的符号链接

The long and short is that we're telling OSX to create a link to the Desktop folder in your DropBox, but to treat the link as if it were the default Desktop folder itself.总而言之,我们告诉 OSX 在 DropBox 中创建一个指向 Desktop 文件夹的链接,但将该链接视为默认的 Desktop 文件夹本身。 In this way, when you save things to your Mac Desktop, they'll appear on your Desktop as before, but actually be stored in your new DropBox folder.这样,当您将内容保存到 Mac 桌面时,它们会像以前一样出现在您的桌​​面上,但实际上存储在您的新 DropBox 文件夹中。 Here's how to do it…这是如何做到的……

ln -s /Users/your-user-name/Dropbox/Desktop/ ./Desktop

This worked perfectly for me.这对我来说非常有效。

Credit goes to https://ifyouwillit.com/life/auto-sync-your-mac-desktop-folder-with-dropbox/归功于https://ifyouwillit.com/life/auto-sync-your-mac-desktop-folder-with-dropbox/

Move everything you have on your Desktop to the cloud:将桌面上的所有内容移至云端:

mv ~/Desktop/* ~/Dropbox/MyDesktopOnTheCloud/

Remove your current local Desktop folder from your home directory:从主目录中删除当前的本地桌面文件夹:

sudo rm -rf ~/Desktop

Create a symlink to your Desktop folder on the cloud:创建指向云上桌面文件夹的符号链接:

ln -s ~/Dropbox/MyDesktopOnTheCloud ~/Desktop

On MacOS Catalina , in order to prevent the system from deleting your symlink and creating a blank Desktop folder after every system restart, change the flag of the symlink:在 MacOS Catalina 上,为了防止系统在每次系统重新启动后删除您的符号链接并创建一个空白的桌面文件夹,请更改符号链接的标志:

sudo chflags -h schg ~/Desktop

It's important to specify the -h option to instruct the chflags command not to follow the symlink.指定-h选项以指示chflags命令不要跟随符号链接很重要。 In this way, the link is unchangeable by the system, but the destination folder is not.这样,链接是系统不可更改的,但目标文件夹不是。 The system can indeed save screenshots to the Desktop, for instance.例如,系统确实可以将屏幕截图保存到桌面。 If you omit the -h option, the symlink will be deleted after reboot and the folder in Dropbox will be marked as unchangeable instead.如果省略-h选项,符号链接将在重启后被删除,而 Dropbox 中的文件夹将被标记为不可更改。

I found that MacOS Catalina resets the symlink on reboot.我发现 MacOS Catalina 会在重新启动时重置符号链接。 sudo chflags schg (path to link) prevents MacOS from touching the link. sudo chflags schg(链接路径)可防止 MacOS 接触链接。

You can try using symlinks.您可以尝试使用符号链接。 There is a pretty good post for dropbox usage here - try to adopt this for your needs.有一个相当不错的职位的Dropbox使用这里-尽量采用此为您的需求。

These are the essential parts:这些是必不可少的部分:

Navigate in Terminal to your Dropbox folder by typing通过键入在终端中导航到您的 Dropbox 文件夹

cd /Users/YourMacUsernameHere/Dropbox

and then hitting return.然后点击返回。 A new line in Terminal will appear that's终端中将出现一条新行,即

Your-Computer-Name:Dropbox YourUserName$

Create your symbolic link by typing通过键入创建您的符号链接

ln -s ~/FolderNameHere 

and hitting return.并击中返回。 A folder will appear in your Dropbox folder with the alias/shortcut arrow and it will immediately begin uploading.一个文件夹将出现在您的 Dropbox 文件夹中,带有别名/快捷方式箭头,它会立即开始上传。

To create a symlink to your Desktop, type要创建指向桌面的符号链接,请键入

ln -s ~/Desktop

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

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