I am attempting to write a housecleaning script that does the following:
1) goes to a specific directory
2) deletes all contents of that directory but a specific directory within it.
So my users all keep and use the Shared directory in OSX. Within /Users/Shared there are also standard named directories i.e. Clients, Regulators, Prospects and other rif raf that makes it in there that shouldn't be in there.
Basically want to go into /Users/Shared and rm -Rf all contents that are not named Clients
i've tried a couple of scripts but am getting weird stdout from my terminal and the interior directories are not touched.
#!/bin/sh
LOCO=`dirname /Users/Shared/`
KEEPER=Clients
rm - Rf ${LOCO}/* == ${KEEPER}
stdout tells me that I'm basically calling dirs that don't exist. I'm sure that my syntax sux and looking for a nudge in the right dirECTION (hah couldn't help that)
thanks for your time,
nom