Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Your project/folder structure for /home/*username*
44 points by newsisan on Sept 17, 2010 | hide | past | favorite | 33 comments
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.



Firstly, everything I'm talking about sits in my Dropbox folder, so for all intents and purposes Dropbox is my root. I highly recommend doing this - it makes backups automatic, and you don't have to worry about the backup problem ever again.

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.


You're putting a lot of faith in Dropbox not to ever corrupt any of your file.


So far, Dropbox has never corrupted anything. I don't think I've ever heard of it corrupting someone's files, either.

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?


Depends on the criticality of the data you're hosting. For casual data I think that's fine. For stuff you absolutely need to be sure never gets lost or destroyed, I think you really need a backup routine that incorporates separate physical media.


Even worse: Your files readable to support staff from Dropbox. Do you trust them that much? I would recommend encrypted backups.


What's the reasoning for putting the version control of a project in a separate folder?

Using your names and RCS, I'd have

  ~/Projects/ProjectName/.hg
(with subfolders for design/ docs/ scripts/ etc - which are also saved in version control)


I don't want everything sitting in the same repository. This might just be paranoia, but since I'm using a DVCS (Mercurial), I don't want everyone who downloads the project to have to download the source code + design documents + anything else. The design, especially, is mostly made up of binary files, which don't play too well with source control since they're not diffable.

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?


Just curious, what type of account you have on Dropbox?


50Gb. 25Gb is enough for all the things I really care about, and 15Gb of that is my music collection!

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.


I do the same thing as the parent does. I have the 50gb account on db, have a bunch of code/docs/other things, and use like 15%.

highly recommend using dropbox as your root.


I'm a neat freak. I don't let cruft accumulate at the top level.

.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.


I'm not sure how important it really is, unless your current layout doesn't work well for you. That is, most things don't really care where you save your documents, code or other files.

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.


  ~/i     # internal (stuff I made)
  ~/x     # external (stuff I downloaded, etc.)

  # exceptions to the above:
  ~/i/collab
  ~/i/mashup

  ~/bin
  ~/tmp
That's it for top-level directories.

I also really like the (new?) trend of programs keeping their dotfiles in ~/.config/program-name/foorc


I like the ~/x and ~/i. I also usually create a ~/tmp for temporary builds and stuff that I don't want to have automatically cleaned up, but about a year ago I changed the default download location in the browsers I use to /tmp -- this has saved me a lot of space and a lot of time cleaning stuff up or trying to remember what something is or why I downloaded it -- the system cleans it up, and if I want to keep it after looking at or evaluating it, the act of moving/copying it out of /tmp is enough of an effort to help me remember more about it.


the $XDG_CONFIG_HOME from freedesktop.org's XDG Base Directory Specification.


Most of my coding is hobby or university assignments because of that, my structure is pretty simple. I also compile a lot of programs and install them to my local/ prefix within my home directory (minimize system-wide clutter and restrict apps to just my homedir).

~/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.


~/coding/old # all the files I don't want to work on anymore, but may need to check for a way I did something in the future

~/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}.


Current: Standard Mac OS X structure + Code/ + Games/ + .bin/

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.


Pretty self explanatory, I think.

  ~/ ls
  abs  bin  dev  media

  ~/ ls dev/
  freelance  opensource  personal  work

  ~/ ls media/
  audio  books  games  images  mnt  tmp  torrents  video


What do you put in abs ?


Sorry it took so long to reply, there used to be a RSS feed of when somone replied to your HN comments but I guess it stopped working.

Anyway, it's for Arch Linux packages. http://wiki.archlinux.org/index.php/ABS


I stated using Dropbox to handle some of my needs, but I have implemented it in a slightly different way than I am seeign most peopel do it. I put the "real" directory, say Projects under ~/Dropbox/Projects, then I symlink that back to ~/Projects

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.


Being a mac user my $HOME is /Users/$user.

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.


Mine is extremely messy at the moment; it's currently centered around what sort of VCS I decide to use / pull code from.

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. :)


Have you seen http://joey.kitenet.net/code/mr/ ? You just put all your repos in a list and it can keep them all synched at one command, independent of what type of repo it is.


I grabbed a 50gb Dropbox account and put everything in there, so my "home" is actually /home/username/Dropbox and includes: * Documents * Music * Photos * Work

Makes working between two computers a piece of cake and provides 100% backup with versioning. Best $99/year I spend.


~/projects/client-name/client-project.com/

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.


I drop folder trees (subtrees of home and var-www and the like) into dropbox as soft links too.

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 ...?


~/Projects has legacy projects and stuff in SVN

~/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


Here's my (user oriented) folder structure on Arch Linux:

  AUR
  Books
  Desktop
  ISOs
  Music
  Others
  Photos
  Retrieved
  Screenshots
  Wallpapers


Not sure if this is what you are looking for. I am a bit of GTD person.

@defer

@delegate

@review

@todo

@note

Each gigs/proj depend on the stage they are in each of these folders.


Did you mean C:/Documents and Settings/Administrator ?


books/ (all longer pdfs/ebooks),

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).




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: