New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

Help making shell script for basic command


Post Reply New Thread Subscribe

 
Thread Tools
ericconn

 
Member Since: May 14, 2012
Posts: 7
ericconn is on a distinguished road

ericconn is offline
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 (http://www.alvinpoh.com/how-to-make-...al-in-mac-osx/), 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
server/
.......people/
.............person1/
.............person2/ etc.

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

Thanks for any help.
QUOTE Thanks
Raz0rEdge

 
Raz0rEdge's Avatar
 
Member Since: Jul 17, 2009
Location: MA
Posts: 7,737
Raz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant future
Mac Specs: 27" i7 iMac, 24" iMac, 13" Macbook Air, iPhone 5 & 5S, iPod Nano 7th Gen, iPad 2 16GB WiFi, iPad 3

Raz0rEdge is offline
On Linux (that's what I have access to right now) something like this would work
Code:
for dir in `find /Volumes -mindepth 3`; do
    ln -s "$dir " /shortcuts/
done
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..

--
Regards
...Ashwin



Be sure to read the Community Guidelines | The more information you provide, the better answers you get, remember GIGO.
QUOTE Thanks
ericconn

 
Member Since: May 14, 2012
Posts: 7
ericconn is on a distinguished road

ericconn is offline
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.
QUOTE Thanks
ericconn

 
Member Since: May 14, 2012
Posts: 7
ericconn is on a distinguished road

ericconn is offline
sorry, link mentioned above: http://codesnippets.joyent.com/user/jvs/tag/prune
QUOTE Thanks

Post Reply New Thread Subscribe


« Install OS X 10.8.2 on 2009 iMac | Reinstalling iBook G4 »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Login Script to Mount SMB Drive to Desktop redbergy OS X - Operating System 12 07-05-2011 04:31 PM
How to mimick the "free" command used in Linux in OS X. unixdude45 OS X - Apps and Games 0 05-12-2011 02:06 AM
Making a Shell Script Executable surfwax95 OS X - Development and Darwin 10 08-25-2010 05:15 PM
Making script automatically run ruffryder1613 OS X - Operating System 1 06-09-2009 12:51 PM
Shell Broken ? A.I. BOT OS X - Operating System 3 08-28-2006 02:32 PM

All times are GMT -4. The time now is 04:21 PM.

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

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?