Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/bin/bash
- #Read the Windows formatted SMB path to the user's home directory
- #Stores only the URL string from \\ onwards
- #Note that four backslashes represent a single backslash here
- WinFormattedDirectory=`dscl /Active\ Directory/All\ Domains -read /Users/$USER SMBHome | grep \\\\\\\\.* -o`
- #If AD fails to return a path to the user space, don't proceed as we don't want to break the user's documents folder
- #This is particularly important if the user is logged in as a local user
- if [ $? -eq 0 ]
- then
- #Replace the server name \\FS0[0-9] from the start of the string with /Volumes to give us the share name and path
- #Note that eight backslashes represent a single backslash here
- ShortenedWinFormattedDirectory=`echo $WinFormattedDirectory | sed s/\\\\\\\\\\\\\\\\fs0[0-9]/\\\\/Volumes/`
- #Replace all backslashes with forward slashes
- #Note that eight backslashes represent a single backslash here
- MacFormattedDirectory=`/Volumes/$USER`
- #Change permissions on local documents folder so that we can delete it
- chmod -R -N ~/Documents
- #Remove the local Documents folder
- rm -rf ~/Documents
- #Create a SymLink to the network documents folder
- ln -s $MacFormattedDirectory ~/Documents
- #Create Downloads directory in network My Documents folder if it doesn't already exist
- mkdir ~/Documents/Downloads
- #Change permissions on local Downloads folder so that we can delete it
- chmod -R -N ~/Downloads
- #Remove the local Downloads folder
- rm -rf ~/Downloads
- #Create a SymLink to the network Downloads folder
- ln -s ~/Documents/Downloads ~/Downloads
- #Create My Videos directory in network My Documents folder if it doesn't already exist
- mkdir ~/Documents/My\ Videos
- #Change permissions on local Movies folder so that we can delete it
- chmod -R -N ~/Movies
- #Remove the local Movies folder
- rm -rf ~/Movies
- #Create a SymLink to the network My Videos folder
- ln -s ~/Documents/My\ Videos ~/Movies
- #Create My Music directory in network My Documents folder if it doesn't already exist
- mkdir ~/Documents/My\ Music
- #Change permissions on local Music folder so that we can delete it
- chmod -R -N ~/Music
- #Remove the local Music folder
- rm -rf ~/Music
- #Create a SymLink to the network My Music folder
- ln -s ~/Documents/My\ Music ~/Music
- #Create My Pictures directory in network My Documents folder if it doesn't already exist
- mkdir ~/Documents/My\ Pictures
- #Change permissions on local Pictures folder so that we can delete it
- chmod -R -N ~/Pictures
- #Remove the local Pictures folder
- rm -rf ~/Pictures
- #Create a SymLink to the network My Pictures folder
- ln -s ~/Documents/My\ Pictures ~/Pictures
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement