As far as I know there are these;
- Camel case = coolFileName
- Snake case = cool_file_name
- Kebab case = cool-file-name
- Pascal case = CoolFileName
- Dot notation = cool.file.name
- Flat case = coolfilename
- Screaming case = COOLFILENAME
Personally I prefer the kebab/dot conventions simply because they allow for easy “navigation” with (ctrl+arrow keys) between each part. What are your preferences when it comes to this? Did I miss any schemes?
Pascal or camel case for code, snake case for files and screaming snake case for globals
I try to make everything Pascal case. It’s easy to read in a terminal and pretty easy to type.
I like Camel Case for code, but mostly because it’s ingrained in my brain, coming from Java as my first language.
For folders and files, I like Kebab Case.
Luckily, I was not ingrained by my first programming language like that, or my coworkers would strangle me.
I started with BASIC, which allowed only two letters for variable names…
Both snake and camel case. Sometimes I mix it in the same project and I hate myself for it
I use flat case most of the time, but I also try to stick to single word files so there is no case to get in the way.
I think for documents I might share like a PDF I’d use Pascal case.
In a classroom or teaching setting I will sometimes use Kebab case as I find it is the least confusing and makes it extra clear where the word division is. Similarly I avoid Dot notation since it’s confusing for folks coming from a Windows world.
And I would avoid Screaming because that’s just too loud anywhere.
Isnt CAPSLOCK case for screaming? 😁
YEAH CRUISE CONTROL BABY
FileName_IMPORTANTCATEGORIZATION.yyyy.ext
With all bits being optional (not every file needs the date it refers to)
So eg (slight modifications for anonymity):
SunLifeInsureance_SIGNED.2024.Q1.pdf
SpotDoesTrickAndFalls_ORIG.mp4
JSmithPassport_CANADA.2015_2025.pdf (I am a dual citizen)
JSmithCOVIDPass_DOSE1.2021.pdf
For files? I like title case (like in article headlines). For example, I have a “Shell Tricks.txt”. I’m not really consistent though, sometimes it’s all lowercase or whatever really.
spaces in filenames?
oh, my sweet summer child.I don’t use a computer from the 90s. It can handle it.
It depends a bit on the use case. I try to follow naming conventions within specific environments like Python. When just sorting some documents together, I usually do a mix of Kebab and snake case, where I split semantic parts with underscores and connect words with dashes like
2024-08-30_author_document-name_other-important-info.ext
This is exactly what I do. It lends itself to something like ‘prefix_specific-info_version’ which is both sortable and easy to read.
Is something like this defined in a standard somewhere?
Yeahh that’s the best IMO ! But I get most of the time stuck with some
testOFtest001
files/directory… cause I’m lazy…But I always ALWAYS regret it afterward… :/
I can tell that this guy fucks
Camel case, but with a twist – if the next word is about to start after a capital letter, I’ll have it lower case.
topSecretFBIfile.txt for example
Interesting, I’d tend to demote the initialism, ie topSecretFbiFiles.tar.gz
That’s probably more commonly accepted. I defer to whatever my team is doing, but for my own files, I wouldn’t want things like UsStudentList or USStudentList which both look wrong to me.
USstudentList looks right to me, and if that’s wrong, I’m okay with being wrong! Haha
COOLFI~1.AME
Im dead! MS-DOS vibes
10 PRINT “FARTS” 20 GOTO 10
Man I miss basic.
It’s more like QBasic dialect, but it’s still actively maintained. It can generate binaries and everything for modern machines.
I don’t have a consistent style for everything and it depends on the circumstances. snake_case is often used, especially to avoid spaces. Sometimes I just do flatcase instead, and in rare cases also kebab-case or combined_snake-and-kebab-case. The combined_case is often useful to group parts of the name, like a dates and version numbers together and to indicate what part is constant; example-name_2024-08. Sometimes I also do the “Title Case”, which is basically PascalCase, but with spaces. Or even even more weird, “Python_Case”, which is PascalCase, but with snake_case, when I want to avoid spaces.
I often avoid dots in regular filenames, unless they indicate a file extension or format, such as “.svg” and “.inkscape.svg” to indicate its a specific version of the SVG format. Or “.xiso.iso”, as a specific compressed version of the regular ISO file (for use with Xemu emulator). Basically the same logic and tradition as “.tar.gz” (but in reverse order).
I don’t like extra dots simply because pattern matching might get weird down the road. Keep dots for extension type and use Pascal to make it easier to read multiple words. Flatcase only if it’s short or I’m lazy for a temp file.
For files, date+Snake: 20240831Letter_to_Rodney.odt For variables, Screaming
camelCase for non-source-code files. I find camelCase faster to “parse” for some reason (probably just because I’ve spent thousands of hours reading and writing camelCase code). For programming, I usually just use whatever each language’s standard library uses, for consistency. I prefer camelCase though.
How about “cool file name”?
All my systems use modern file systems that are case sensitive and can contain any character except
/
and\0
.True. Linux, Android, Windows all have no problems
Using dots in a file though…
Using commands on that is still more annoying, so no way
not really
You can easily escape spaces with
\
and my modern shell (fish) suggests and completes filenames for me anyway, so i don’t have to type more than the first word in more than 90% of cases.Typing
\
in those cases instead of_
is super annoying.In my keyboard layout backspace is behind altgr.
the standard keyboard layouts (qwerty, qwertz, etc.) are mostly trash
are there any good alternative keyboard layouts for your native language (finnish if im not mistaken)?
In Germany there is the Neo Family: Neo{,2}, NeoQwert{y,z}, Bone, Mine, … as well as offsprings of that, but I guess you need your diacritics: å ä and ö. While Neo layouts have these diacritics available, they are made for german, so only ä ö and ü are easily accessible.
Now do it with a for loop on every file in a dir with thousands of files
for i in path/to/dir/* dosomething_with_my_file $i end
where is the problem? fish shell doesn’t split arguments at spaces
$IFS splits files at spaces
IFS is a special shell variable in bash, ksh and POSIX shells that lets you configure how the shell splits words
by default it splits at spaces tabs and newlines
I use
fish
a shell that is intentionally not POSIX compatible. While it borrows some principles from Bash and POSIX, it simplifies a lot of things and removes most footguns. Words are split at new lines in fish, which admittedly can also cause troubles, but not nearly as often as in bash and other POSIXy shells.Wtf why would you intentionally not be POSIX compatible?
IWRITELOTSOFBASH