Ask HN: Your project/folder structure for /home/*username*
What is your folder structure for your files?
There isn't much info on this, but it is a pretty central component of using a computer.
There isn't much info on this, but it is a pretty central component of using a computer.
34 comments
[ 3.2 ms ] story [ 71.5 ms ] thread@defer
@delegate
@review
@todo
@note
Each gigs/proj depend on the stage they are in each of these folders.
Using gnome/fedora quite some time I have the standard Desktop, Documents, Music, etc which sit mostly stagnant due to dropbox.
Some of the interesting others: ~/Dropbox My dropbox folder.
~/prefix where I install various libs and things I'm using. I have my /home on a seperate partition so I can quickly re-install without losing settings. Using ~/prefix saves having to re-build the more obscure dependencies/tools I end up using.
~/projects where I keep checkouts projects I'm working on or using (they get installed from here into ~/prefix). It is also an eclipse workspace folder, for the times when I need eclipse.
~/media a symlink to my other drives (DVD, usb devices, etc) so that when I samba in (rarely) I can easily get to those -- I was too lazy to add shares for them.
~/coding/test # all the eetsy bitsy little proving this works code
~/Dropbox/coding/#{project_name} # a place for projects small enough not to be githubbed, but large enough to be dropboxed. Actually I keep my gitubbed projects here too, my code will never die. Also, my OS setup is a bit weird, and sometimes it is easier to just have dropbox move something automatically to/from my native OS, so that's a plus.
For the actual folder structure of the files themselves I try to follow the typical Rails structure, but honestly for 2 or 3 file projects its all just there in #{project_name}.
On Arch Linux I had: downloads/ files/ games/ media/ projects/ school/ tmp/ work/
Not the most optimal layout. There was a quite a big overlap between tmp/ and downloads/ and tmp/ and projects/. files/ should have been labeled personal/. downloads/ got bloated. school/ was the only well organized directory.
When I get my laptop, I plan to use: downloads/ personal/ work/, and depending on whether I need it, media/. Depending on whether I use fossil, work/repos/.
Perhaps I should set up some script to auto-purge downloads/, but I'm sure that would lead to disaster.
I also have a ~/projects/dev/ folder for administrative-related stuff (contract templates, accounting, etc.)
Finally I have a soft link to ~/projects/ in ~/Dropbox/ so that whenever I make a change to any file it's instantly backed up in my Dropbox.
What I could really do with is being able to tell dropbox -"all this tree but not this branch please" so I can exclude a leaf or twig.
I've also had problems when symlinks have caused a folder to be listed twice and so the same content (a huge folder) got uploaded twice and breached my account limit, oops.
Lastly I'd like a more asynchronous approach to be possible "download all files but don't delete when other clients do" which helps to create a complete working backup locally.
Any of this in the pay version ...?
Inside Dropbox, I have several folders relating to various things (Pictures, Music, Documents, etc.) The most interesting are:
Resources - A folder where I keep all my resources. This basically means my KeePass database, various fonts and web templates I've bought or collected over the years, my .emacs and vimrc files, and various other software resources.
Software - Here I keep all my portable software, the stuff I have to have on me to use a computer without pulling my hair out in frustration.
Projects - All my software projects (I have a separate "Graphical Projects" folder for graphical stuff, etc.).
Inside Projects, I have several folders by project name. These are arranged like so:
ProjectName/ <- Root, holds any subfolder with anything related to the project.
ProjectName/db <- Hold the sqlite database, which I usually use on my personal computer (most projects are Python/Django).
ProjectName/site_media <- Holds my static and dynamic media for Django projects. Static Media holds symlinks to the actual project folders.
ProjectName/repos <- Holds all the repos.
ProjectName/repos/main <- The main source code repo. Mercurial is used for SCM.
ProjectName/repos/design <- All my design-related documents.
ProjectName/repos/* <- Any other copies of my main for fixing small bugs and trying new things. I use Mercurial, so this is a standard practice.
And this is how the actual project folder looks:
ProjectName/repos/main/* <- All the files related to environment, for example, my Sublime Text project file, .bat files to automatically start the Django server, .hgtags and .hgignore, etc. Basically, things that are "meta" to the project, and not actual source code. Makes for good separation.
ProjectName/repos/main/.hg <- Mercurial folder
ProjectName/repos/main/project_name <- The actual source code
Hope that helps.
highly recommend using dropbox as your root.
I recommend Dropbox every chance I get, since I really think it's an amazing service. You pay 10$ a month for never having to worry about the backup problem every again (not to mention the fact that my laptop and other desktop are always synced). Well worth the money, IMO.
Plus, factor in the fact that Dropbox keeps backups of all your files, so in the worst case, I'm guessing they can restore anything that breaks.
Put that against the fact that not using Dropbox means I'm trusting my hard disk not to die on me, and I think Dropbox comes out ahead by far.
Do you know of any reason I should be more worried?
Using your names and RCS, I'd have
(with subfolders for design/ docs/ scripts/ etc - which are also saved in version control)Also, I really only have 2 subfolders - a design folder which is kept under SVN (so that I don't worry about the really large files), and a main folder kept under Mercurial. All other folders are just clones of the main folder for when I want to mess around with different ideas, and these have to be different repos anyway.
Is that clearer?
code/ (all code),
docs/ (most docs, mostly notes on various things),
Dropbox/ (all local folders are symlinked here),
<mycompanyname>/ (shared Dropbox folder with everything in),
qqq/ (misc that I wouldn't cry about losing, heavy files),
tmp/ (downloads, random put-some-place for now),
uni/ (everything related to university),
vis/ (visual stuff, ie pictures and images).
~/src - All of my personal projects, project structure varies depending on language/type of project. Most directories/project top-levels are scm directories.
~/build - any apps/libs not made by me that I compile and install local to my home directory
~/local - items from build/ get compiled with --prefix=${HOME}/local and install to here, ~/local/bin is in my path
~/www/(sub.domain.tld)/ - apache vhosts for local testing stuff (not production)
My $PATH contains ${HOME}/local/bin:${HOME}/local/games and in some cases other local/<bigprogramwithlotsoffiles>/bin entries.
So I have
~/Development/svn_root - my working copy of the svn repo my group uses for all code related to project work.
~/Documents/$Company_Name/Projects/YYYY - All non-code related project documents are artifacts are stored there.
~/Documents/Reference - All documentation for everything since it spans time frames and projects
Everthing is backed up to an external drive via Time Machine as well as synced somewhere external.
Makes working between two computers a piece of cake and provides 100% backup with versioning. Best $99/year I spend.
Anyway, it's for Arch Linux packages. http://wiki.archlinux.org/index.php/ABS
With that said:
~/repos : root directory of all of the repos I'm using.
~/repos/git
~/repos/svn
~/repos/cvs
...
And then underneath those, I have a smattering of repos from various sources. It's ugly as hell, and I'm really liking this thread mostly so I can get a better idea on how I should reorganize my stuff. :)
~/Git-Projects has almost all my current projects which are on GitHub
~/htdocs is my local Apache root and it used for testing front-end work or simple PHP stuff
.git of course. Almost everything is under version control, either here or in its own repo.
.notes for my personal data. Email, chat logs.
.local for programs and configuration. In university we often had our home directories NFS mounted on linux, sun and IRIX machines. I would install say vim binaries in all three platforms and my path would include $HOME/.local/$UNAME/bin to get at the right binaries on each machine.
These days all the action is in .local/share. .local/share/scripts is where I keep my zshrc and so on, .local/share/config has my rcfiles. In particular .local/share/config/vim is several megabytes of vim configurations in their own git repo.
.runtime for generated files like zcompdump and whatnot.
I try really hard to minimize dotfiles outside of these, and to keep what is important somewhere in this hierarchy using environment variables or aliases. The one directory I can't get rid of is .ssh.
www is my homepage at http://akkartik.name.
Attic for old projects, usually git repos. Eventually they get burned to DVD and deleted.
Other than this I usually have one or two projects at any time. They are usually all I want to see when I ls. Lately all there's been here is readwarp.
lrwxr-xr-x 1 john staff 16 Sep 15 02:33 Projects -> Dropbox/Projects
Is there any reason to do it the other way? That is placing the soft link in the dropbox folder.
I also really like the (new?) trend of programs keeping their dotfiles in ~/.config/program-name/foorc