| View previous topic :: View next topic |
| Author |
Message |
Dark Foo l33t

Joined: 21 Nov 2008 Posts: 921 Location: 127.0.0.1
|
Posted: Mon Jan 23, 2012 1:56 pm Post subject: How do you name your folders? |
|
|
I know in Linux that you can use spaces in folders and file names and that you have to use \ if you use the command line to enter any folder with a space in them. Do you use any special naming conventions like . - or _ , or do you just leave the spaces there?
Guess this is more of an aesthetics thing more than anything else _________________ I know 43 ways to kill with a SKITTLE, so taste my rainbow bitch. |
|
| Back to top |
|
 |
John R. Graham Administrator


Joined: 08 Mar 2005 Posts: 4847 Location: Somewhere over Atlanta, Georgia
|
Posted: Mon Jan 23, 2012 2:02 pm Post subject: |
|
|
Spaces in file names are evil or, at the very least, problematic. I typically use '-' because it's not a shifted character (i.e., you don't have to hold down the shift key to produce it) and '_' is.
- John _________________ Yoda: "Intentionally left blank, this space is."
Last edited by John R. Graham on Mon Jan 23, 2012 2:04 pm; edited 1 time in total |
|
| Back to top |
|
 |
Jaglover Advocate


Joined: 29 May 2005 Posts: 3399 Location: Saint Amant, Acadiana
|
|
| Back to top |
|
 |
Dark Foo l33t

Joined: 21 Nov 2008 Posts: 921 Location: 127.0.0.1
|
Posted: Mon Jan 23, 2012 2:29 pm Post subject: |
|
|
and do you do the same with your files? _________________ I know 43 ways to kill with a SKITTLE, so taste my rainbow bitch. |
|
| Back to top |
|
 |
mv Advocate


Joined: 20 Apr 2005 Posts: 2588
|
Posted: Mon Jan 23, 2012 2:32 pm Post subject: |
|
|
| Jaglover wrote: | | I never use spaces, they interfere with bash completion. |
Yet another reason to use zsh.
Of course, file names containing spaces or newlines are in principle not a problem. However, shell makes it hard to deal with them properly, so there are certainly many shell scripts in the wild which will break with them. Similarly, there will be many scripts which will break if you use filenames starting with "-". So just to make sure to get no problems if I should ever be in the need to use such scripts, I usually avoid these names. |
|
| Back to top |
|
 |
champ Tux's lil' helper

Joined: 25 Oct 2006 Posts: 94 Location: Thailand
|
Posted: Mon Jan 23, 2012 3:22 pm Post subject: Re: How do you name your folders? |
|
|
| Dark Foo wrote: | Do you use any special naming conventions like . - or _ , or do you just leave the spaces there?
|
I never use spaces, using -, _, or CamelCase. Actually, for folders I generally give them simple names which do not use spaces.
My problem is getting Windows users to think the same way when they send me files.  _________________ "Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety." - Benjamin Franklin
blog: johnsearth.blogspot.com |
|
| Back to top |
|
 |
Etal Veteran


Joined: 15 Jul 2005 Posts: 1580
|
Posted: Mon Jan 23, 2012 4:01 pm Post subject: |
|
|
| mv wrote: | | Jaglover wrote: | | I never use spaces, they interfere with bash completion. |
Yet another reason to use zsh. |
bash works just fine.
| Code: | $ touch 'a b c'
$ ls a<tab>\ b\ c
a b c
$ ls 'a<tab> b c'
a b c |
_________________ “And even in authoritarian countries, information networks are helping people discover new facts and making governments more accountable.”– Hillary Clinton, Jan. 21, 2010 |
|
| Back to top |
|
 |
myceliv Apprentice


Joined: 29 Nov 2007 Posts: 178
|
Posted: Mon Jan 23, 2012 5:10 pm Post subject: |
|
|
For no particular reason I use underscore_for_directories, and dash-for-files-and-the-like. Maybe it's because I can never remember what the DIR_COLORS mean. I don't much like Capitalized directories like $HOME/Music, etc. but some power greater than me seems to like them so I put up with them.
Not what you asked, but also in shell scripts I use $underscore_for_variables to save hassles with - being interpreted as an option prefix. |
|
| Back to top |
|
 |
mv Advocate


Joined: 20 Apr 2005 Posts: 2588
|
Posted: Mon Jan 23, 2012 7:10 pm Post subject: |
|
|
| myceliv wrote: | | in shell scripts I use $underscore_for_variables to save hassles with - being interpreted as an option prefix. |
Actually, you must: - is not allowed in variable names. bash allows it in function names, but this is not POSIX. |
|
| Back to top |
|
 |
JESSEJJ89 Tux's lil' helper


Joined: 22 Dec 2011 Posts: 90
|
Posted: Thu Jan 26, 2012 9:23 pm Post subject: |
|
|
| I use anything except for spaces, which I use underscore instead. |
|
| Back to top |
|
 |
ppurka Advocate

Joined: 26 Dec 2004 Posts: 2782
|
Posted: Thu Jan 26, 2012 10:11 pm Post subject: |
|
|
I use anything, spaces and all. It is ridiculous to expect trouble from linux in this date with spaces in filenames and directory names. These are handled just fine by all important programs. One notable exception is latex. _________________ emerge --quiet redefined | E17 vids: I, II |
|
| Back to top |
|
 |
gorkypl Apprentice

Joined: 04 Oct 2010 Posts: 203 Location: Kraków, PL
|
Posted: Thu Jan 26, 2012 11:06 pm Post subject: |
|
|
I use underscores, this is the way I learned it back in the 1980's
Recently started using all UTF8 chars in names, though... |
|
| Back to top |
|
 |
mv Advocate


Joined: 20 Apr 2005 Posts: 2588
|
Posted: Fri Jan 27, 2012 5:25 pm Post subject: |
|
|
| ppurka wrote: | | I use anything, spaces and all. It is ridiculous to expect trouble from linux in this date with spaces in filenames and directory names. These are handled just fine by all important programs. One notable exception is latex. |
latex is even exceptionally clean concerning treatment of spaces. More trouble is to be expected by various image conversion scripts using latex or ghostscript. Moreover, with standard unix tools like "make" (and thus also autotools) you will almost surely run into problems if e.g. subdirectories of your project contain spaces. |
|
| Back to top |
|
 |
ppurka Advocate

Joined: 26 Dec 2004 Posts: 2782
|
Posted: Fri Jan 27, 2012 5:45 pm Post subject: |
|
|
| mv wrote: | | latex is even exceptionally clean concerning treatment of spaces. More trouble is to be expected by various image conversion scripts using latex or ghostscript. Moreover, with standard unix tools like "make" (and thus also autotools) you will almost surely run into problems if e.g. subdirectories of your project contain spaces. | That's really unfortunate. In this day and age, it is quite pathetic to need someone to name all projects as named without spaces. Spaces make file names more readable.
One solace is that the end user does not have to think about these things since all the graphical programs can handle spaces very well. _________________ emerge --quiet redefined | E17 vids: I, II |
|
| Back to top |
|
 |
Dorsai! Apprentice


Joined: 27 Jul 2008 Posts: 239 Location: Bavaria
|
Posted: Fri Jan 27, 2012 11:33 pm Post subject: |
|
|
For scripting and other system related stuff (i.e. files that will not get touched in normal day to day operation) I use no special characters at all when possible. Also I try to keep everything as short and unique as possible. But that is a fairly common place practice I suppose.
In all other stuff (multimedia, documents etc.) I use all characters. For a long time I even had the forbidden windows (:/\ etc.) characters in my music collection because they were auto renamed after the tags. But because Rockbox for my mobile player is limited to vfat I had to rename them.
Other than that, bash-completion not understanding spaces is just another moment that shows you that "bash" actually means "broken ancient shell". While the already suggested zsh is very nice I use fish because it works out of the box and I can get it everywhere I want to work with only one command and do not have to configure anything including Tab completion.
Also in most high level and/or script languages like python handling spaces is a piece of cake so I am not sure why I would concern myself with some naming convention that is not natural for to read. Spaces are there for a reason. |
|
| Back to top |
|
 |
Jaglover Advocate


Joined: 29 May 2005 Posts: 3399 Location: Saint Amant, Acadiana
|
Posted: Sat Jan 28, 2012 1:01 am Post subject: |
|
|
It's becoming very clear it's about personal preferences. I for one agree with John, spaces are evil. Looking at a "spaced" file or directory feels like looking at a command with [invalid] options to me. Using Linux for too long I guess. _________________ Please learn how to denote units correctly! |
|
| Back to top |
|
 |
|