Mac Forums

Mac Forums (
-   OS X - Operating System (
-   -   Help making shell script for basic command (

ericconn 09-26-2012 11:00 AM

Help making shell script for basic command
I need to make a shell script for a command to create aliases for 500 folders in 500 parent directories. I've found one page that was useful (, however I need to put the aliases on several computers, and once the aliases made with that script are off my computer, the aliases are "dead," due to rights permissions, I assume.

The command works when I copy and paste the commands one by one into Terminal, but I'd rather not do that.

Example of folder structure
.............person2/ etc.

Example of command being used
ln -s "/Volumes/server/people/person1" /shortcuts/

Thanks for any help.

Raz0rEdge 09-26-2012 03:43 PM

On Linux (that's what I have access to right now) something like this would work

for dir in `find /Volumes -mindepth 3`; do
    ln -s "$dir " /shortcuts/

The mindepth here ensures that you get the "server/people/personX" level. Without that, you end up getting "server" and "server/people" as well which you probably don't want.

If mindepth is supported by OS X's "find", then this script should work..

ericconn 09-26-2012 04:08 PM

Thanks, I see what you're getting at there, but that line of code didn't work. Here's a site with how OS X uses mindepth. Any suggestions how to change it to work? Thanks.

ericconn 09-26-2012 04:08 PM

sorry, link mentioned above:

All times are GMT -4. The time now is 09:16 AM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.