Skip navigation

Creating an alias to a folder on a smb drive

1638 Views 2 Replies Latest reply: Mar 15, 2011 1:53 PM by Irvingmike RSS
Irvingmike Calculating status...
Currently Being Moderated
Mar 11, 2011 6:13 PM
I am working on a script for my company that sets up a basic folder structure for each job that we get. I do not have a lot of scripting experience and the part I am stumbling on is, I have a folder on a smb server that I would like to create an alias to on a afp server. I struggled for a while to make folders on the smb drive, but finally was able to do that with some shell scripts.

Here is my script (short to address the current issue):

-- Default Values for testing (Comment out in final script)
set Client_Name to "Aaron Anderson"
set Job_Number to "123456"
set PjMNameLong to "Emily Walbridge"

--Mounting Drive
tell application "Finder"
mount volume "afp://prep1/Opus"
mount volume "smb://gbpnet/DOCUMENTS"
end try
end tell

--Variable setting
set Job_Info to Client_Name & " " & Job_Number
set Job_DUA to Job_Info & " DUA"
set Job_Dir to "Opus:1 Active Prepress:" & Job_Info
set PjMNameLong to "Emily Walbridge"
set PjMNameShort to "Emily W"
set JobLog_PjMName to " To " & PjMNameShort & "'s Prepress Shared folder"

--Making folder structure in the PjMs Prepress Shared folder
set ClientNameShell to findAndReplace(" ", "\ ", Client_Name)
set PjMNameShell to findAndReplace(" ", "\ ", PjMNameLong)
set PjMShareMain to "/Volumes/DOCUMENTS/Staff\ Folders/Project\ management/" & PjMNameShell
set PjMShareClient to PjMShareMain & "/" & ClientNameShell
set mkdir_var to "mkdir " & PjMShareClient
do shell script mkdir_var
end try
set mkdir_var to mkdir_var & "/" & Job_Number
do shell script mkdir_var

--Aliasing DUA folder back to job folder
tell application "Finder"
make new alias to PjMShareClient at folder Job_Dir
set name of alias file Job_DUA of folder Job_Info of folder "1 Active Prepress" of disk "Opus" to "zzz DUA"
end tell

on findAndReplace(To_Find, To_Replace, The_String)
set text item delimiters to To_Find
set Text_Items to text items of The_String
set text item delimiters to To_Replace
set The_String to Text_Items as string
end findAndReplace

When run I get the following error:

error "Finder got an error: Can’t make "/Volumes/DOCUMENTS/Staff\\
Folders/Project\\ management/Emily\\ Walbridge/Aaron\\ Anderson" into type
item." number -1700 from "/Volumes/DOCUMENTS/Staff\ Folders/Project\
management/Emily\ Walbridge/Aaron\ Anderson" to item

Anyone have any suggestions as to how to make it work?

Also I would like to put a check in early in the script to see if the folder already exists, if it does not exist then alert the user.I have been successful with this on a afp drive using the following script chunk:

if (exists folder Client_Name of folder "Webtrack_Images") is false then
display alert "Alert: Client Does Not Exist in Webtrack_Images Drive"
message "This client does not exsist in the Webtrack_Images drive. If
this is not a new client, please cancel the script and check the client
name you entered." buttons {"Cancel", "OK"} default button 1
end if

But this code always says the folder does not exist when trying to run it on a smb drive.

Thanks for your help.
Mac OS X (10.6.6)
  • etresoft Level 7 Level 7 (23,905 points)
    Currently Being Moderated
    Mar 11, 2011 6:34 PM (in response to Irvingmike)
    This looks like something that would be much easier with a Perl or other shell script. Either that or manually mount just the directory you want just to the path you want.
    MacBook 2007 (white), Mac OS X (10.6.6), + iMac 27" + iPad + MacBook Pro


More Like This

  • Retrieving data ...

Bookmarked By (0)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.