Created
December 2, 2013 22:14
-
-
Save hawkrives/7760049 to your computer and use it in GitHub Desktop.
Recursive setup of use desktops
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # src="/path/to/folder/that/holds/files/" | |
| src="/System/Library/User Template/English.lproj/Desktop" | |
| # Move to /Users for the duration of the script | |
| cd "/Users" | |
| for user in */; do | |
| # Check if the folder is a directory, and stop a possible error of bash | |
| # executing the loop with "/*" as a directory name. (Happens if there are | |
| # no matches of the */ pattern). | |
| [[ -d "$user" ]] || continue | |
| dest="$user/Desktop" | |
| if [[ -d "$dest" ]]; then | |
| # The '--'flag tells cp to stop looking for command-line options. | |
| # -R is recursive | |
| # -f is force, to override any existing folders. | |
| cp -Rf -- "$src" "$dest" | |
| fi | |
| echo "Done with $user" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello everyone! In today’s fast-paced academic environment, many students find themselves overwhelmed by coursework requirements and tight deadlines. A Paper Writing Service https://paperswritingservice.com/ can be a game changer, offering expert assistance to help ease this pressure. By hiring professional writers with advanced degrees, students receive carefully researched, original papers that meet their specific requirements.