Live data from Hacker News

I'm “still afraid to use spaces in file names” years old

twitter.com

231–240 of 817 posts

Re: I'm “still afraid to use spaces in file names” years old

#231

I work on a complex desktop application, and it's been astounding the number of bugs that have appeared over the years triggered by spaces and other unusual characters in file names. If you do anything with subprocesses or path processing, it's absurdly easy to hit in a thousand different ways, over and over again. Pro tip: rename your development directory (or even better: the workspace path in CI) to put a space an…

Better solution: only allow ASCII, maybe dashes, and up to twelve characters. Problem solved.

Enforce this in LDAP.

Strict convention is better than flexibility and predicting obscure edge cases that can fail.

Re: I'm “still afraid to use spaces in file names” years old

#232

Define " space ". Is the Hangul filler we talked about yesterday a spacing character? Is the zero-width non-breaking space a spacing character? What about the typographic spacing characters? You should better be very afraid of using spaces in filenames. You should do everything you can to support them but you have to know you'll invariably encounter countless cases where you'll have this or that tool that won't work…

You get all those space characters working and then some jerk comes along and uploads a file like this: ŗ̶̧̢͓̳͍͙͔̳̻̥͉̭͓̫̟͍̞̭͉͓͉̮̹͍͚̳̹̬͉͚̰͈̘̐̊̾̈̀̒͒̀͛̓̋̔͊̏͘̚ę̴̨̛̣͙̤̟̬̩̟͙͖̥̹̱̱̊͑͗̇̇͛̆̈́̃͋̓̀̔̍̍̌̐͊̎̓̅̀̕ͅģ̴̹̜̘͍̱̑͐̉̌̐̄̊͛̎́̐̌̅̈́͂͑̈́̋̔͂̊̊̒̒̔͛͆̚͘̕͠e̶̙͕̫̳̘͐̾́̑͆̓͂̿͊̊̍͛͐̌̆͗̌̅̅̔͊̂͛͗̅̕͝͝͝͝x̵̢̧̦̫͖̝̥̹͓̬͖̤̩͚̝̫̋̃̅̈́̆͋̌͑́̎̈́̊̾͒̀̒̎̓͛͊̿̓͊̀̍͐̆̚͝͝-̴̨̮̯͖͖̠̜̲̪͕̘͈͖̮̈́̓̐̃́̅̄̏́̍̉̐͌́̔̓̄͋͗̐̕͜͝ţ̴̢̧̖̗͖̞̮̫̦̼̝̺̼̱̳͓͉̜̟̤̲͖̻͙́̌̈̌̈͆̾̄͊̿̏̓͗̈́̕͜ͅh̶̽́͊̎͐͌̆̍̎̏̕͝…

This legitimately made me laugh out loud in my office.

The characters reach up off the screen as I reply to this. They overlay the comment above you. Amazing. How?

Re: I'm “still afraid to use spaces in file names” years old

#233
post #201

Earlier quoted context omitted.

I go one step further: 2021-11-11_client_project-name.ext 2021-11-11_client_projectName.ext is also OK. But underscore separates fields, hyphens for space replacement.

Maybe you mean `2021-11-11_client_project-name_v2_final.ext`

2021-11-11_client_project-name_v2_final_ridaj(1).ext

Re: I'm “still afraid to use spaces in file names” years old

#234
post #179
post #109

Earlier quoted context omitted.

Did you mean backslashes? I don't know if any filesystem/OS supports forward slashes in filenames

OS X does in the GUI; they're isomorphic to ‘:’ at the UNIX level. (The Mac used ‘:’ as the directory separator.)

And a : in a file name at the GUI level gets turned into a dash! I just tried to name a text file "Foo/Bar 10:01.rtf" and it changed it to "Foo/Bar 10-01.rtf"!

Re: I'm “still afraid to use spaces in file names” years old

#235

Earlier quoted context omitted.

I go one step further: 2021-11-11_client_project-name.ext 2021-11-11_client_projectName.ext is also OK. But underscore separates fields, hyphens for space replacement.

I see and applaud your use of the underscore there, but I must reject the premise! work/client/project/2021-11-11-file.ext is more or less how I lay stuff out. I’d say client/project is a folder level distinction (arguably dates too). [EDIT] Realistically most of the stuff under is git repos and I usually make a “home” repo where I keep org files for tracking hours, notes, and resources related to the engagement.

work/client/project/2021-11-11-file.ext is great until you've got a '2021-11-11-project-status.txt' in a few directories and you need to find one quickly! I do a combination: clients/client/project/2021-11-11-client-project-update.txt

Re: I'm “still afraid to use spaces in file names” years old

#236
My proposal for a shell on the Mac, in the late 80s, was:

- Spaces in filenames get transformed to non-breaking spaces by the filesystem;

- The filesystem treats nbsp as equal to space (just as case-folding treats A=a, B=b, etc.)

Now, argument parsing, mouse double-clicks, etc. all respect filenames as "words", and the output from things like 'ls' just work.

(Yes, I'm well aware that there are case-sensitive filesystems out there. I'd forgotten that iOS was one of those).

Re: I'm “still afraid to use spaces in file names” years old

#237

I work on a complex desktop application, and it's been astounding the number of bugs that have appeared over the years triggered by spaces and other unusual characters in file names. If you do anything with subprocesses or path processing, it's absurdly easy to hit in a thousand different ways, over and over again. Pro tip: rename your development directory (or even better: the workspace path in CI) to put a space an…

My Mac is formatted case sensitive when the default is case insensitive. This will also catch a ton of import related bugs. League of legends doesn’t run until I sed files for instance.

I once returned a printer because the Mac driver and support software expected and enforced case insensitive access and basically couldn't install properly on my case-sensitive HFS+ volume. It half installed and blatantly just didn't work in any way when installed.

Re: I'm “still afraid to use spaces in file names” years old

#238
post #168

Earlier quoted context omitted.

Well, on my disk PROGRA~1 is "Program Files" and PROGRA~2 is "Program Files (x86)", so still works :)

That order is not guaranteed consistent across installations, however.

I wonder if code to this effect has ever been written before

  for (int i = 1; i 

Re: I'm “still afraid to use spaces in file names” years old

#239

I work on a complex desktop application, and it's been astounding the number of bugs that have appeared over the years triggered by spaces and other unusual characters in file names. If you do anything with subprocesses or path processing, it's absurdly easy to hit in a thousand different ways, over and over again. Pro tip: rename your development directory (or even better: the workspace path in CI) to put a space an…

I maintain a similar system, where a variety of companies submit files that get processed through multiple services - it is astounding how ridiculous people’s naming of files can be; spaces are the least concerning!

Re: I'm “still afraid to use spaces in file names” years old

#240

Tangentially, I frequently add dates to filenames to keep things organized. And _always_ in the `YYYYMMDD` format for clarity and technical reasons; `DDMMYYYY` (or God forbid the Americans' `MMDDYYYY`) never made much sense to me.

I do this so often that I have an emacs macro or two that helps me out:

  (defun mdy ()
    (interactive)
    (insert (format-time-string "%04Y-%02m-%02d")))
That inserts the "proper" date format (e.g., 2021-11-11) at the current point.

Then to create a date-stamped file name:

  (defun file-mdy (file-name)
    (interactive "sbasename: ")
    (find-file (format "%s-%s.org" (format-time-string "%04Y-%02m-%02d") file-name))
    (save-buffer))
And a few others.

Nobody seems to misunderstand this date format. US folks might find it annoying, but understand what it means.

Post reply on HN