Hi, I want to develop a script to replace missing folders from home directories. These may have been deleted by the user. A standard home directory will have these folders in it and nothing else:
Desktop, Documents, Downloads, Library, Movies, Music, Pictures, Public, Sites
I also want to move anything that is not one of the standard folders listed here from the root of the home directory into ~user/Documents/ and not overwrite anything there, perhaps by appending a date or something to the file name.
If a folder is missing from the home directory, I want to replace it with one from: /System/Library/User\ Template/English.lproj/ where exists the folders used to create home directories. Then we need to change ownership so that it belongs to the user and not root.
Also, assume that every home directory name is the same as the userid, Liza Jane has userid 'janel' and her home directory is /Users/Students/janel
for user in /Users/Students/* ; do
#here is where I want to replace missing folders for example:
cp -R /System/Library/User\ Template/English.lproj/Sites $user/
chown -R $user $user/Sites
# and move anything non-standard into $user/Documents/
done
exit
Any advice would sure be appreciated.