## Spaces in paths & filenames

Please compose all posts in Emacs.

Moderators: phlip, Moderators General, Prelates

## Spaces in paths & filenames

Yes
20
50%
No
20
50%

Copper Bezel
Posts: 2426
Joined: Wed Oct 12, 2011 6:35 am UTC
Location: Web exclusive!

### Spaces in paths & filenames

Just this. Had a bit of a tiff break out on Reddit recently in a thread about hyphens vs. underscores regarding which inferior substitute was superior instead of just using spaces between the words in the name of a file or folder. (Hyphens, obviously, but this is quite beside the point.)

I don't find it at all difficult to enclose paths in single quotes when I happen to be using CLI. I do like when my filesystem looks like names for things instead of weird and unsightly coding conventions. I do find it frustrating when a script or application manages to fail to correctly treat a path as a string and fails in case of spaces, but that's a problem with the script, not the convention.
So much depends upon a red wheel barrow (>= XXII) but it is not going to be installed.

she / her / her

ucim
Posts: 6543
Joined: Fri Sep 28, 2012 3:23 pm UTC
Location: The One True Thread

### Re: Spaces in paths & filenames

If it looks like the end of a token, it should be the end of a token.

Jose
Order of the Sillies, Honoris Causam - bestowed by charlie_grumbles on NP 859 * OTTscar winner: Wordsmith - bestowed by yappobiscuts and the OTT on NP 1832 * Ecclesiastical Calendar of the Order of the Holy Contradiction * Please help addams if you can. She needs all of us.

Soupspoon
You have done something you shouldn't. Or are about to.
Posts: 3641
Joined: Thu Jan 28, 2016 7:00 pm UTC
Location: 53-1

### Re: Spaces in paths & filenames

Spoiler:
By habit, I use "full quotes", not 'single ones', in DOS. So much so that I'd have to check the contextual differences. Not likely the same as *nix and/or Perl differences - it being DOS, probably entirely interchangeable with only after the "usebackq" FOR-option there being any differentiation between valid quote-characters, save perhaps that single-quotes can contain options with doubles in, without metaing, and verse vica...

But I'll also 'forget' a final quote in a line where I know the ambiguity will resolve.

Code: Select all

D:\SomeDirectory\AnotherDirectory> "c:\program files\foobar\foo" /bar "..\yet another place\bar.foo

...no need to close off the "yet another place" path with a quote, though there is (often - actually depends on how the ARGs get parsed, but best not to assume...) a need to open it.

Anyway...
MaybeBetterToUseCamelcase, but that does have potential for ambiguity, across systems. Intelligent use by a file/label author is necessary, and some people here still remember 8.3 limitations, I'm sure.

There was maybe confusion with jdbgmgr.exe and similar, but I'm reluctant to pad with either - or _ and I rarely use dashes without specific grammatical reasons, e.g. "magic-the gathering", "mgc-gthr", "Magic-theGathering" or other permutations, somewhere I'd use a dash to substitute for a colon (or colon space, or colon dashe [space]) because of the colon itself being more of a problem.

My ultimate decision wouldvbe based upon common sense (or the naïve impression of such), readability (ditto) and possibly an idea of what human/coded recipients of my decisions would have to deal with. I'm not sure I have a single preference, TBH..

Flumble
Yes Man
Posts: 2071
Joined: Sun Aug 05, 2012 9:35 pm UTC

### Re: Spaces in paths & filenames

I often do not trust programs to correctly interpret paths/names with spaces, so I try to put all files that are to be used by a program in a spaceless path. Documents (spreadsheets and stuff) can go where ever.

flicky1991
Like in Cinderella?
Posts: 750
Joined: Fri Feb 11, 2011 3:36 pm UTC
Location: London

### Re: Spaces in paths & filenames

Flumble wrote:I often do not trust programs to correctly interpret paths/names with spaces, so I try to put all files that are to be used by a program in a spaceless path. Documents (spreadsheets and stuff) can go where ever.

That certainly sounds fair. Most of the time, though, I'm naming files that don't need to worry about that.
any pronouns
----
Forum Games Discord
(tell me if link doesn't work)
----
NiteSciFi, sci-fi forum that needs more members

Copper Bezel
Posts: 2426
Joined: Wed Oct 12, 2011 6:35 am UTC
Location: Web exclusive!

### Re: Spaces in paths & filenames

The situational dependency makes an awful lot of sense to me. I don't remember the exact details now, but I've definitely had cases in the past where I'd avoid using spaces within (or anywhere above, obviously) a particular directory where I'm using tools that might be confused by them.

If I can step back from the RW-style posturing intro post, I'm mostly just glad I'm not completely crazy for using spaces in paths at all. One could say that they were significantly less popular in that Reddit thread.
So much depends upon a red wheel barrow (>= XXII) but it is not going to be installed.

she / her / her

phlip
Restorer of Worlds
Posts: 7556
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

### Re: Spaces in paths & filenames

The one thing I try to avoid is having the names of two files be the same except for something after a space... so like "foo" and "foo bar"... because now to access "foo bar" from the CLI using tab-completion, I type "f[tab]" and it gives me foo, and now I have to type a backslash and a space to diambiguate before pressing tab again will complete the rest of the filename.

The really annoying one is using Cygwin, and trying to get to Program Files (x86)... typing pro[tab] autocompletes "Program" (since there's also ProgramData sans space), have to type backslash-space-tab to autocomplete "Files", then backslash-space-tab again to autocomplete "(x86)". If they'd just named it "Program Data" with a space it could at least be just pro-tab-f-tab-backslash-space-tab, and shave off a keystroke.

It's petty, but it irritates me a little.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

Copper Bezel
Posts: 2426
Joined: Wed Oct 12, 2011 6:35 am UTC
Location: Web exclusive!

### Re: Spaces in paths & filenames

I don't know if this is a Bash thing, but I notice that if I type a leading quote mark, tab completion can include spaces. It'll handily close the quote before the slash and I can keep drilling down from there.
So much depends upon a red wheel barrow (>= XXII) but it is not going to be installed.

she / her / her

phlip
Restorer of Worlds
Posts: 7556
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

### Re: Spaces in paths & filenames

Yeah, but that would require me to think ahead, and type an opening quote mark before getting into this mess...

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

Weeks
Hey Baby, wanna make a fortnight?
Posts: 1997
Joined: Sat Aug 23, 2008 12:41 am UTC
Location: Ciudad de Panamá, Panamá

### Re: Spaces in paths & filenames

Flumble wrote:I often do not trust programs to correctly interpret paths/names with spaces, so I try to put all files that are to be used by a program in a spaceless path. Documents (spreadsheets and stuff) can go where ever.
This. I am eternally paranoid. Though I'll use spaces if I'm feeling especially lazy and it's just a txt or screenshot that I'll keep on my desktop
NieXS wrote:Oh god that smiley ruined it.
suffer-cait wrote:One day I'm gun a go visit weeks and discover they're just a computer in a trashcan at an ice cream shop.
Mutex wrote:Enjoy the shoe!

Nyktos
Posts: 138
Joined: Mon Mar 02, 2009 4:02 pm UTC

### Re: Spaces in paths & filenames

Flumble wrote:I often do not trust programs to correctly interpret paths/names with spaces, so I try to put all files that are to be used by a program in a spaceless path. Documents (spreadsheets and stuff) can go where ever.
What are you doing with those spreadsheets that doesn't involve them being used by any program?!

phlip wrote:The one thing I try to avoid is having the names of two files be the same except for something after a space... so like "foo" and "foo bar"... because now to access "foo bar" from the CLI using tab-completion, I type "f[tab]" and it gives me foo, and now I have to type a backslash and a space to diambiguate before pressing tab again will complete the rest of the filename.

The really annoying one is using Cygwin, and trying to get to Program Files (x86)... typing pro[tab] autocompletes "Program" (since there's also ProgramData sans space), have to type backslash-space-tab to autocomplete "Files", then backslash-space-tab again to autocomplete "(x86)". If they'd just named it "Program Data" with a space it could at least be just pro-tab-f-tab-backslash-space-tab, and shave off a keystroke.

It's petty, but it irritates me a little.
zsh handles this the way you'd want fwiw.

Demki
Posts: 199
Joined: Fri Nov 30, 2012 9:29 pm UTC

### Re: Spaces in paths & filenames

Funnily enough, Powershell handles tab-completion with files that have spaces in them just fine, it even automatically wraps the path in double quotes for you.
Powetshell is far from perfect, but at least you can easily type /pro[tab, perhaps more than once] to get "C:\Program Files (x86)\" with the cursor after the second \.

Copper Bezel
Posts: 2426
Joined: Wed Oct 12, 2011 6:35 am UTC
Location: Web exclusive!

### Re: Spaces in paths & filenames

Hmm, anyone know a way to get that style of tab completion in Bash? (Or something similar to Bash?)

Edit: Not the spaces, the paging-through-possibilities-with-tab.
So much depends upon a red wheel barrow (>= XXII) but it is not going to be installed.

she / her / her

hotaru
Posts: 1042
Joined: Fri Apr 13, 2007 6:54 pm UTC

### Re: Spaces in paths & filenames

Copper Bezel wrote:Hmm, anyone know a way to get that style of tab completion in Bash? (Or something similar to Bash?)

use zsh?

Code: Select all

factorial = product . enumFromTo 1isPrime n = factorial (n - 1) mod n == n - 1

Copper Bezel
Posts: 2426
Joined: Wed Oct 12, 2011 6:35 am UTC
Location: Web exclusive!

### Re: Spaces in paths & filenames

Will do! Thanks! = ]

Edit: Oh HELL yes

Edit again, having actually got my .zshrc configured to something I can live with that includes Ctrl+Backspace: Oh HELLS YES
So much depends upon a red wheel barrow (>= XXII) but it is not going to be installed.

she / her / her

Flumble
Yes Man
Posts: 2071
Joined: Sun Aug 05, 2012 9:35 pm UTC

### Re: Spaces in paths & filenames

Nyktos wrote:
Flumble wrote:I often do not trust programs to correctly interpret paths/names with spaces, so I try to put all files that are to be used by a program in a spaceless path. Documents (spreadsheets and stuff) can go where ever.
What are you doing with those spreadsheets that doesn't involve them being used by any program?!

Shush, you know what I mean.
Some command line programs/scripts don't work nicely with spaces in their arguments.

Demki wrote:Funnily enough, Powershell handles tab-completion with files that have spaces in them just fine, it even automatically wraps the path in double quotes for you.

Indeed, even windows' classic command prompt has that behaviour.

Speaking of shells, I'd recommend fish over zsh for end-user stuff. blah blah blah not posix-compliant blah blah but it has rich completion out of the box. (zsh-completion-generator sounds great, but it'll have to hook into pacman for me to leave my local maximum).

Copper Bezel
Posts: 2426
Joined: Wed Oct 12, 2011 6:35 am UTC
Location: Web exclusive!

### Re: Spaces in paths & filenames

For whatever reason, I'm keeping zsh as my default login shell but have fish set as the default command for my terminal emulator (Tilix). It's ... really nice, with the suggestions and history and everything. I might have to actually start using some terminal apps.
So much depends upon a red wheel barrow (>= XXII) but it is not going to be installed.

she / her / her

Thesh
Made to Fuck Dinosaurs
Posts: 6269
Joined: Tue Jan 12, 2010 1:55 am UTC

### Re: Spaces in paths & filenames

The times I've had problems with spaces in paths almost exclusively result from scripts that pass input to the shell.
Summum ius, summa iniuria.

Xenomortis
Not actually a special flower.
Posts: 1422
Joined: Thu Oct 11, 2012 8:47 am UTC

### Re: Spaces in paths & filenames

spaces_should_be_abolished_and_we_should_all_type_like_this

Derek
Posts: 2178
Joined: Wed Aug 18, 2010 4:15 am UTC

### Re: Spaces in paths & filenames

We're not cavemen. If your program can't correctly handle paths with spaces, your program is bad.
Last edited by Derek on Wed Jun 28, 2017 10:31 pm UTC, edited 2 times in total.

flicky1991
Like in Cinderella?
Posts: 750
Joined: Fri Feb 11, 2011 3:36 pm UTC
Location: London

### Re: Spaces in paths & filenames

you are program
any pronouns
----
Forum Games Discord
(tell me if link doesn't work)
----
NiteSciFi, sci-fi forum that needs more members

Copper Bezel
Posts: 2426
Joined: Wed Oct 12, 2011 6:35 am UTC
Location: Web exclusive!

### Re: Spaces in paths & filenames

Got a point, though. If you are program can't handle spaces in paths, then you are program is bad.
So much depends upon a red wheel barrow (>= XXII) but it is not going to be installed.

she / her / her

Soupspoon
You have done something you shouldn't. Or are about to.
Posts: 3641
Joined: Thu Jan 28, 2016 7:00 pm UTC
Location: 53-1

### Re: Spaces in paths & filenames

chridd
Has a vermicelli title
Posts: 828
Joined: Tue Aug 19, 2008 10:07 am UTC
Location: ...Earth, I guess?
Contact:

### Re: Spaces in paths & filenames

Soupspoon wrote:By habit, I use "full quotes", not 'single ones', in DOS. So much so that I'd have to check the contextual differences. Not likely the same as *nix and/or Perl differences - it being DOS, probably entirely interchangeable with only after the "usebackq" FOR-option there being any differentiation between valid quote-characters, save perhaps that single-quotes can contain options with doubles in, without metaing, and verse vica...
Does DOS/Windows allow single quotes at all? I seem to remember it only liking double quotes, and wine cmd says "File not found" when I try to use single quotes with dir and type.

For me, it depends on whether I intend to use the file from the command line (or open it in Vim, or reference it in an HTML or CSS file or some other sort of computer code). If so, I usually use all lower case and hyphens; otherwise, I'll sometimes use capital letters and spaces.
~ chri d. d. /tʃɹɪ.di.di/ (Phonotactics, schmphonotactics) · she(?)(?(?)(?))(?(?(?))(?))(?) · Forum game scores
mittfh wrote:I wish this post was very quotable...
chridd (on Discord) wrote:
Dummy wrote:Sorry You're Gay Dads
SYG'D
marionic (on Discord) wrote:sleep in grave

EvanED
Posts: 4331
Joined: Mon Aug 07, 2006 6:28 am UTC
Contact:

### Re: Spaces in paths & filenames

chridd wrote:Does DOS/Windows allow single quotes at all? I seem to remember it only liking double quotes, and wine cmd says "File not found" when I try to use single quotes with dir and type.
Looks like Windows 7 cmd doesn't like single quotes, though I'm not sure if that extends to the C runtime (which parses command lines into argv[] for programs using a traditional C/C++ main function), and I don't have an easy way to test that quickly. So it may be the case that programs that aren't built into cmd will tend to work correctly. I do have one data point, which is that I can run winword "file with spaces.docx" and it opens, but if I use single quotes, it doesn't work and splits it at spaces. So if that's using the usual crt, it doesn't like single quotes.

PowerShell though accepts single quotes.

Soupspoon
You have done something you shouldn't. Or are about to.
Posts: 3641
Joined: Thu Jan 28, 2016 7:00 pm UTC
Location: 53-1

### Re: Spaces in paths & filenames

chridd wrote:Does DOS/Windows allow single quotes at all? I seem to remember it only liking double quotes, and wine cmd says "File not found" when I try to use single quotes with dir and type.
After I wrote that, I tested as soon as I got back to the first Windows machine (XP) and discovered much as you say.

Except, for some reason, the strange behaviour of the (usefully expanded) FOR options. Without "usebackq" option the (string) part is the traditional file-list, ("string") is a literal string (except likely with variable substitution) and ('string') is a command to interpolate (at last! ...so much useful stuff could now be done, previously only in *nix shell-scripts). But with "usebackq", it's now ('string') and (command), instead. And I've no idea why. It's like that in W2K too (checked that later) and I've yet to check any (named) NT version of Windows to see where the need for two different legacy schemes might have merged from. It's not as if the backquote version of FOR looks anything like the non-DOS shell counterparts, to be so confusable...

I can only imagine it's a sop to those with alternate national keyboards. Maybe «»-quotes as default, etc?

Never mind, though.

speising
Posts: 2279
Joined: Mon Sep 03, 2012 4:54 pm UTC
Location: wien

### Re: Spaces in paths & filenames

Unintuitively, usebackq is most useful to remove the specialness of double quotes, so you can have them inside 'a "string" literal'.

Soupspoon
You have done something you shouldn't. Or are about to.
Posts: 3641
Joined: Thu Jan 28, 2016 7:00 pm UTC
Location: 53-1

### Re: Spaces in paths & filenames

I should have thought of that. For some reason (maybe stemming from my reading the whole "FOR /?" documentation and thus being aware of all possible options, as soon as I found out it was so much more expanded from what it had been previously) I've always used "usebackq" when doing anything remotely complicated with new-FOR, and thus had to reinterpret the escaping of various quotes in reverse when my version of the approach caused occasional 'meta'ing problems.

Demki
Posts: 199
Joined: Fri Nov 30, 2012 9:29 pm UTC

### Re: Spaces in paths & filenames

chridd wrote:Does DOS/Windows allow single quotes at all? I seem to remember it only liking double quotes, and wine cmd says "File not found" when I try to use single quotes with dir and type.

Testing on a windows 10 machine:
cmd.exe doesn't accept 'single quotes', only "double quotes".
powershell accepts both, with 'single quotes' representing a verbatim string, and "double quotes" allows you input special characters with a backtick(like n for new line).
Basically, if you are using windows, either use powershell or download some other shell. (There is the project of getting ubuntu running on windows called windows subsystem for linux)

Copper Bezel
Posts: 2426
Joined: Wed Oct 12, 2011 6:35 am UTC
Location: Web exclusive!

### Re: Spaces in paths & filenames

I haven't tried it (not on Windows enough) but I've heard the system, despite being a full and real Ubuntu system running on top of NT + WSL instead of Linux, is limited in terms of what it can do back to the Windows system. There's Fedora and openSUSE coming as well, though.

One thing I don't like much about fish is that there's no way to enable Ctrl+Backspace for ^W. I bound Alt+Backspace but a decade and a half of muscle memory and the way I use the keyboard in every other app are not going to rebind so quickly. Not quite enough to make me stick to Z Shell, though, as fish's suggestion feature goes beyond tab completion into possible divinity.
So much depends upon a red wheel barrow (>= XXII) but it is not going to be installed.

she / her / her

trpmb6
Posts: 425
Joined: Tue Jul 09, 2013 6:27 pm UTC

### Re: Spaces in paths & filenames

I almost exclusively use underscores in all file structures and file names because of my time working with a major aircraft manufacture (will remain nameless) that was (until quite recently) very reluctant to allow any changes to their various programs (usually due to aircraft certification and backwards compatibility issues). Suffice to say, some of their programs did not like spaces. Some did. In some cases you would have files used by multiple programs where it would sometimes work, sometimes not. Extremely frustrating when you are a new engineer and never used any of the programs and keep getting errors for an input file that worked just fine elsewhere. Then you ask around and its a simple "oh, remove the spaces from filenames of your input files."

Its been a long time since I've worked for that OEM but I still put underscores on EVERYTHING i use. Even the file structures for all the pictures of my kids. At this point it's kind of an OCD obsession of mine.
(terran/protoss/zerg/fascist fuck)

hotaru
Posts: 1042
Joined: Fri Apr 13, 2007 6:54 pm UTC

### Re: Spaces in paths & filenames

*is definitely not writing whatever the opposite of malware is to change all underscores in paths and filenames to spaces*

Code: Select all

factorial = product . enumFromTo 1isPrime n = factorial (n - 1) mod n == n - 1

Soupspoon
You have done something you shouldn't. Or are about to.
Posts: 3641
Joined: Thu Jan 28, 2016 7:00 pm UTC
Location: 53-1

### Re: Spaces in paths & filenames

From bitter experience, I know that running defrag from DOS 6.22 (or earlier) on LFN-supporting FAT areas like a Win95 (or later) does a brilliant job of reducing trivial and inconsequential directory names such as "Program Files" to the handier "PROGRA~1", and likely a whole set of "MICROS~1","MICROS~2", "MICROS~3", directories beneath it...

That was a fun problem to resolve (especially when one hadva hard time finding another Win95 user, at the time, to get a 'DIR /S /someotheroptionsIforget | FIND "~" > file' copied to floppy to aid in the subsequent manual repair...). Everyone shouod try it.

hotaru
Posts: 1042
Joined: Fri Apr 13, 2007 6:54 pm UTC

### Re: Spaces in paths & filenames

Soupspoon wrote:From bitter experience, I know that running defrag from DOS 6.22 (or earlier) on LFN-supporting FAT areas like a Win95 (or later) does a brilliant job of reducing trivial and inconsequential directory names such as "Program Files" to the handier "PROGRA~1", and likely a whole set of "MICROS~1","MICROS~2", "MICROS~3", directories beneath it...

That was a fun problem to resolve (especially when one hadva hard time finding another Win95 user, at the time, to get a 'DIR /S /someotheroptionsIforget | FIND "~" > file' copied to floppy to aid in the subsequent manual repair...). Everyone shouod try it.

back in those days, that shouldn't have been too much of an issue. reinstalling windows regularly was already necessary for most people, so there was an obvious easy solution.

Code: Select all

factorial = product . enumFromTo 1isPrime n = factorial (n - 1) mod n == n - 1

Soupspoon
You have done something you shouldn't. Or are about to.
Posts: 3641
Joined: Thu Jan 28, 2016 7:00 pm UTC
Location: 53-1

### Re: Spaces in paths & filenames

It was my own machine, my first experience of post 3.x Windows, with no way of knowing how the reinstall would work (it had been pre-installed by the company I'd bought it from, something I'd avoid in a PC, these days) and still somewhat a mystery to me. Hence the silly error. I had no fall-back, and no easy method to backup of everything the reinstall would have (seemingly) wiped. No easy copying to USB (pkzip spannng onto countless HD floppies was probably my nearest option to that). But I knew that if I got a tree listing of some kind that I could return all the tilde names to original LFN ones.

(Although that install of Windows had tilde SFNs now scattered around the registry, where it had automatically gone "Can't find 'Long Name With Spaces In'... Change the reference to this similar-looking 'LONGNA~1'!" during that first, fateful bootup after my mistake, when everything had started failing and warning...)

Basically, I was a bit of a n00b with Win95 (as indeed was everybody, in that particular month in 1995!). My prior decade of DOS experience was no use. In fact was behind my 'smart' idea to use the older defrag when I hadn't been convinced that the Windows one was actually doing the job I thought it should...

(A couple of months later, though, I totally aced a job interview after being asked if I knew how to create a shortcut on the desktop, and I listed at least a half dozen different alternative methods straight off the top of my head. I think I stunned them. I got that job, and it turned into one of the best jobs I ever had. Though that might have been just been coincidence, and/or luck)

trpmb6
Posts: 425
Joined: Tue Jul 09, 2013 6:27 pm UTC

### Re: Spaces in paths & filenames

Soupspoon wrote:From bitter experience, I know that running defrag from DOS 6.22 (or earlier) on LFN-supporting FAT areas like a Win95 (or later) does a brilliant job of reducing trivial and inconsequential directory names such as "Program Files" to the handier "PROGRA~1", and likely a whole set of "MICROS~1","MICROS~2", "MICROS~3", directories beneath it...

That was a fun problem to resolve (especially when one hadva hard time finding another Win95 user, at the time, to get a 'DIR /S /someotheroptionsIforget | FIND "~" > file' copied to floppy to aid in the subsequent manual repair...). Everyone shouod try it.

UGH I too remember having to deal with this.
(terran/protoss/zerg/fascist fuck)

trpmb6
Posts: 425
Joined: Tue Jul 09, 2013 6:27 pm UTC

### Re: Spaces in paths & filenames

Soupspoon wrote:(A couple of months later, though, I totally aced a job interview after being asked if I knew how to create a shortcut on the desktop, and I listed at least a half dozen different alternative methods straight off the top of my head. I think I stunned them. I got that job, and it turned into one of the best jobs I ever had. Though that might have been just been coincidence, and/or luck)

Lol, look how far we have come since then. Just imagine being asked that question in an interview today. The look on your face would probably be priceless.
(terran/protoss/zerg/fascist fuck)

shieldforyoureyes
Posts: 342
Joined: Sat Apr 19, 2008 9:00 am UTC
Contact:

### Re: Spaces in paths & filenames

Copper Bezel wrote:I don't know if this is a Bash thing, but I notice that if I type a leading quote mark, tab completion can include spaces. It'll handily close the quote before the slash and I can keep drilling down from there.

That's from the GNU readline library, which bash uses.

Mutex
Posts: 1377
Joined: Wed Jan 09, 2008 10:32 pm UTC

### Re: Spaces in paths & filenames

Related to this, I made a fun discovery recently that both Windows and Linux will allow you to make a file with nothing but spaces in its name. And you can have multiple files in the same directory whose names are just different numbers of spaces. You need to use the -Q flag with ls to see the names properly:

Code: Select all

$ls -1Q" "" "" " Otherwise you just get: Code: Select all $ ls -1      `

In Windows, you need to do this through a terminal emulator (Git Bash worked for me), Windows Explorer won't allow you to create them, and actually throws an error if you try deleting them! So, fun prank potential there obviously. The Linux file manager I tried allowed both creation and deletion.

chridd
Has a vermicelli title
Posts: 828
Joined: Tue Aug 19, 2008 10:07 am UTC
Location: ...Earth, I guess?
Contact:

### Re: Spaces in paths & filenames

Mutex wrote:Related to this, I made a fun discovery recently that both Windows and Linux will allow you to make a file with nothing but spaces in its name.
A long time ago, when I was using the original (non-Unixy) Mac OS and was much younger, my organization strategy involved when a folder was getting too full, leaving everything where it was and creating a subfolder called " " with all the files created after that point (so this folder would be at the top of the list). I also heavily used spaces at the beginnings of file names for a similar purpose (everything's important enough that it should go at the top of the list!); also a few folders starting with ~ so they'd go at the end. I don't remember any programs having an issue with this.
~ chri d. d. /tʃɹɪ.di.di/ (Phonotactics, schmphonotactics) · she(?)(?(?)(?))(?(?(?))(?))(?) · Forum game scores
mittfh wrote:I wish this post was very quotable...
chridd (on Discord) wrote:
Dummy wrote:Sorry You're Gay Dads
SYG'D
marionic (on Discord) wrote:sleep in grave