Open multiple tabs in iTerm2 with a specific directories

Posted on

QUESTION :

I would like to know if this is possible.

I want to set up some script or command that will open 5 tabs and each tab that will open will have their own directory specified

All in the same window

tab 1: open ~/folderA1
tab 2: open ~/folderA2
tab 3: open ~/folderA3
tab 4: open ~/folderA4
tab 5: open ~/folderA5

This is on iTerm2 in Mac OS X.

I know I can do something like CMD+T and then open each of them using cd ~/folderA1 and so on, but if there is a command that I can set up or a script that after executing they will do that all at once I would love to know if there is a way to do so.

ANSWER :

Update: Newer iTerm requires you to change the syntax, so this would look like:

tell application "iTerm"
tell current window
create tab with default profile
end tell
tell current tab of current window
set _new_session to last item of sessions
end tell
tell _new_session
select
write text "cd "$dir""""

Leave a Reply

Your email address will not be published.