this post was submitted on 09 Aug 2023
79 points (95.4% liked)

Asklemmy

43148 readers
1615 users here now

A loosely moderated place to ask open-ended questions

Search asklemmy πŸ”

If your post meets the following criteria, it's welcome here!

  1. Open-ended question
  2. Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
  3. Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
  4. Not ad nauseam inducing: please make sure it is a question that would be new to most members
  5. An actual topic of discussion

Looking for support?

Looking for a community?

~Icon~ ~by~ ~@Double_[email protected]~

founded 5 years ago
MODERATORS
 

Edit: Thank you guys for your insightful answers!

all 40 comments
sorted by: hot top controversial new old
[–] [email protected] 60 points 1 year ago

I use command line a lot. I hate needing to add backslashes before spaces or put quotes around file names. It's easier to just use underscores.

[–] jsveiga 55 points 1 year ago (1 children)

Spaces are not the end of the world, but very annoying:

On a bash command line, they make it harder to handle a list of files returned by a command as argument to another.

On the command line (lin or win), they require escaping or quoting when used as arguments or script/executable names.

On many programs, if you cut&paste the complete path to the file (for example in a network drive), you can click on the path and it will access the file, but spaces in filenames or directories breaks that (and it's not bad programming, the program simply can't guess where the link ends).

When you mention the name of the file in a documentation or message, it may lead to misintepretation, and it's just fugly:

"You can find more information in the attached document file.pdf".

What is the name of the file? it can be "the attached document file.pdf", "attached document file.pdf", "document file.pdf" or "file.pdf".

Also when mentioned in a text, the file name may end up split in separated lines or even pages, and will more likely be subject to autocorrect.

When copying the file name in a text, in most environments you can double-click to select the whole name, but it doesn't work if it has spaces.

Now, if you never ever type or copy/paste a file name, and only ever access files through a graphical interface, then it makes no difference.

But then you start getting to comfy and if anything goes, why not non-ascii chars too? And that opens a different can of troubles.

[–] [email protected] 3 points 1 year ago

Browsers also dont like them!

[–] [email protected] 46 points 1 year ago (1 children)

I know it isn't, but I'm afraid not to

[–] [email protected] 33 points 1 year ago (1 children)

I know I don't have to but it feels dirty

[–] [email protected] 6 points 1 year ago (1 children)

I still try and stick to the 8.3 convention as far as possible. I don't like LFNs.

[–] [email protected] 4 points 1 year ago

8.3 is horrible in almost any moderately complex system. We have one at work and you basically need a index / translation document to figure out what the files or scripts do. The Database tables have similar short name limits.

You eventually memorize the ones you use often but it creates a huge new / external parties to understand the system.

[–] [email protected] 41 points 1 year ago

Instead of spaces? Not necessarily but it helps prevent edge cases

[–] Jakylla 25 points 1 year ago* (last edited 1 year ago) (1 children)

Also, hasn't been said yet, but when a file name with a space is uploaded to the net, the url will replace spaces with "%20" (for technical reasons), making the URL looking bad

(but still not mandatory to replace spaces by underscodes)

Example: http://example.com/the%20file%2042.png vs http://example.com/the_file_42.png

[–] [email protected] 4 points 1 year ago

Ohhhhhhhhhhh, neat.

[–] [email protected] 21 points 1 year ago (2 children)

WelcomeToCamelCaseMyFriend.png

[–] ElderWendigo 21 points 1 year ago
[–] [email protected] 8 points 1 year ago (3 children)

But then you have to press shift if you want to use the file in Linux terminal...

[–] [email protected] 4 points 1 year ago (1 children)

...But at least it saves you from having to use quotes or escaping out the spaces with \

[–] [email protected] 2 points 1 year ago

I'd rather use snake_case for file names in Linux that way you don't have to press shift until the end of the first word, and byt that time you probably have enough characters for tab completion.

[–] [email protected] 1 points 1 year ago

Or make your shell be case-insensitive

[–] [email protected] 0 points 1 year ago

or pressing capslock before and after each uppercase, if you're one of those people

[–] [email protected] 18 points 1 year ago (1 children)

TLDR; No

It hasn't been necessary in a long time, unless you're a developer who frequently needs to type in filenames in everywhere (since the command line needs extra protection against spaces and other symbols)

The OS (Windows, Mac, Android, etc) handles thar all for you so you don't have to worry about it (unless you happen to use a badly-written program that doesn't understand spaces, but this is super rare to begin with, and more protected against as time goes on)

[–] jsveiga 8 points 1 year ago

Even non-developers may hate spaces in filenames, when links to the file you send in a message don't work because clicking on them uses only up to before the first space.

[–] [email protected] 16 points 1 year ago (1 children)

That depends, if you have the fortune (misfortune?) of using the CAD software Creo/ ProE from PTC then spaces are verboten since they haven't progressed from the days where the software was written for UNIX.

[–] [email protected] 4 points 1 year ago (1 children)

Damn this just made me realize why I use so many _ in my file names. Used to use PTC shit in a previous job very heavily.

[–] [email protected] 3 points 1 year ago (1 children)

Looks at both your screen_names…

[–] [email protected] 2 points 1 year ago

To be fair mine only has an underscore because Lemmy doesn't support periods in user names. I have actually barely used the software I was talking about and use another one that doesn't care.

[–] darcy 12 points 1 year ago

never use spaces. never use special characters like |$&";?*'. avoid non-ascii. case is preference, i personally use kebab-case

[–] [email protected] 11 points 1 year ago (1 children)

Just in general? No. But I may still use spaces or camel case sometimes on Linux because it makes it a little faster for me to reference a file without escaping the spaces

[–] [email protected] 4 points 1 year ago (1 children)

Camel case is the way. Why use underscore instead of space when you could just,.. not?

[–] [email protected] 2 points 1 year ago

Stockholm syndrome from whatever the convention is for your daily programming language. Long live snake case 🐍

[–] [email protected] 9 points 1 year ago (1 children)

Why underscores? Dashes are easier to type!

[–] [email protected] 14 points 1 year ago (1 children)

Dashes for dates and ids. Underscores for spaces.

ISP-7_compliance_report_2023-08-09.pdf

[–] [email protected] 8 points 1 year ago (2 children)

You mention dashes but then used hyphens. πŸ˜•

[–] [email protected] 2 points 1 year ago

You are technically correct. The best kind of correct.

[–] [email protected] 2 points 1 year ago (1 children)

Aren’t they the same thing?

[–] [email protected] 5 points 1 year ago* (last edited 1 year ago) (2 children)

Hyphen - dash β€” I think, it could be the other way around

[–] [email protected] 1 points 1 year ago

TIL. Alright, then let's use minus signs!

[–] [email protected] -2 points 1 year ago

Vaginal shied or pinch of spice, but when to use which?

[–] [email protected] 7 points 1 year ago

Only if you want my respect

[–] [email protected] 5 points 1 year ago

Using - is much nicer.

[–] [email protected] 4 points 1 year ago

Windows has issues with leading spaces in certain applications, but no, you don't need to replace spaces with underscores in general nowadays.

[–] [email protected] 1 points 1 year ago

I'd still advise against it if you're using Windows. A space is interpretered as more than a single character meaning you'll hit the 255 character limit for paths quicker if you have a large folder structure. I've seen this happen many times in my time as a support technician.