Standardised project folder structure
Define and open a standardised project structure in the Finder, to remove mental load in switching between projects.
I keep these commands in a separate file that is kept in Dropbox so that it is synced between computers, and load them from my ~/.profile
file with the following
. ~/Dropbox/Automation/bash/projects
Define project structure
The following makes a new project called project1
newproject project1
Customise the folders to what makes sense to you. For example
analysis/input - input files analysis/scripts - scripts that process the input analysis/temp - temporary files that can be deleted because they can be recreated paper/raw - files used to make figures, such as photoshop files paper/old - old versions of manuscripts are archived here reference/reports - reports prior to manuscript format reference/meetings - meeting notes related to project
These are setup with the following function.
function newproject {
mkdir $1
cd $1
mkdir analysis analysis/input analysis/scripts analysis/temp analysis/output
echo $1/analysis > README.md
mkdir paper paper/raw paper/old
mkdir reference reference/reports reference/meetings
}
Quickly open project folders
The following allows to quickly open multiple folders related to a project in tabs of the same finder window. It allows to quickly get back to working on the project. Each project needs to be setup once.
The naming convention is for all projects to start with pr_
so that tab completion in the terminal can identify them. You must use the full path to all folders. The function calls an appleScript.
function pr_project1()
{ osascript -e 'set paths to {"/Users/username/git/project1", "/Users/username/git/project1/scripts", "/Users/username/git/project1/input", "/Users/username/git/project1/output", "/Users/username/git/project1/reference"}
tell application "Finder" to activate
tell application "System Events"
keystroke "n" using command down
end tell
repeat with path in paths
set applePath to POSIX file path
tell application "System Events"
keystroke "t" using command down
end tell
delay 1
tell application "Finder"
set target of the front Finder window to applePath
end tell
end repeat'
}