Skip to content

Instantly share code, notes, and snippets.

@hawkrives
Created December 2, 2013 22:14
Show Gist options
  • Select an option

  • Save hawkrives/7760049 to your computer and use it in GitHub Desktop.

Select an option

Save hawkrives/7760049 to your computer and use it in GitHub Desktop.
Recursive setup of use desktops
#!/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
@annabellebrooks

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment