Posted on 04-16-2020 12:04 AM
Hi,
We are using Dropbox and i'm looking for a way to redirect the user folders like Documents etc to redirect to Dropbox.
This makes sure that user folders are always synced and available if something happens to their laptop.
Anyone has some ideas how to achieve this?
Posted on 04-16-2020 12:58 AM
Have a look here
Posted on 04-17-2020 07:14 AM
thanks for the blog post.
Will be testing this and hopefully post a working solution
Posted on 04-17-2020 09:18 AM
Replace by new reply... see below
Posted on 04-17-2020 09:37 AM
Couple of little changes made it better.
But now I have to go to the Finder Preferences to enable the desktop, etc again.
Anyone has an easy fix for that?
Another thing I need to build in, is if a user runs this on a new laptop it should keep the files on Dropbox and copy anything that is in the local desktop to Dropbox again.
'mv' doesn't seems to be able to do that, any options for that? (maybe: if target exists; then rsync source target, remove source ??)
DBCompany="$4"
DBFolder="Dropbox ("$4")"
consoleuser=$(/usr/bin/python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + " ");')
mkdir "/Users/$consoleuser/$DBFolder/LocalMac"
chown -R $consoleuser "/Users/$consoleuser/$DBFolder/LocalMac"
mv "/Users/$consoleuser/Desktop" "/Users/$consoleuser/$DBFolder/LocalMac"
mv "/Users/$consoleuser/Documents" "/Users/$consoleuser/$DBFolder/LocalMac"
ln -s "/Users/$consoleuser/$DBFolder/LocalMac/Desktop" "/Users/$consoleuser/Desktop"