Live data from Hacker News

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

twitter.com

661–670 of 817 posts

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

#661

Earlier quoted context omitted.

That may be a part of the problem but honestly I don't feel like all these new crazy interfaces are easy to learn either. I mean how do you come up with the lithany xinput calls for? You need to understand the syntax for specifying a device. You need to know that you're to set a libinput property, and you need to know the name of that property, and it's not documented in xinput man page, and of course you need to kno…

alias mouseoff='xinput set-prop 11 "Device Enabled" 0' alias mouseon='xinput set-prop 11 "Device Enabled" 1' Kind of ridiculous if you ask me.

It is, but they actually have a shortcut for that (--disable, --enable).

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

#662

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…

Seems like MS had the same idea according to an answer in the link: > Microsoft intentionally made programs install to C:\Program Files on Windows 95+ to force programmers to deal with spaces in filenames.

It not only keeps people on their toes due to the whitespace. The folder name is even localized. E.g. with german settings there is C:\Programme and c:\Programme (x86).

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

#663

Earlier quoted context omitted.

Yeah, except that tells me nothing useful... The question is exactly the same: So where do I install this random binary I downloaded from the internet or compiled myself? Is it /opt, /usr/bin, /usr/local/bin, or /bin? Where do I put the dependencies I compiled for this software - /usr/lib, /usr/local/lib, /lib, /opt/lib, /opt/ /lib, or what?

I was taught /usr/local/bin /opt is for standalone packages, so if it’s a single file, no. /bin is only for stuff needed on single user mode, so probably not (unless that’s what the binary is for. /usr/bin is going to typically contain files installed by your package manager and should probably be left unaltered by human hands. The deps I would assume /usr/local/lib but it hasn’t ever come up for me.

Fun fact: Debian is working towards[1] and Arch already has merged / and /usr. /bin is a soft link to /usr/bin and similarly with sbin and lib.

[1]: https://wiki.debian.org/UsrMerge

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

#664

Earlier quoted context omitted.

If I am not writing all of my installation scripts by hand, because that would be really intense, then every folder gets filled with random bits of software. Offering too many similar choices leads to mess. There's nothing fundamentally different between using one or more of these options and using the only option, except that in the second case there isn't any opportunity to make mess. > You can do `configure --pref…

Use Gnu Stow to keep the random bits contained in their own app directory that is symlinked into the /usr/local tree. Then you can manage everything without leaving orphan files behind.

Very cool

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

#665
post #435
post #411

I have an overly-aggressive function in my .bashrc to rename all files in the current directory: # Rename all files in a directory rn() { rename "s/ /-/g" * rename "s/_/-/g" * rename "s/–/-/g" * rename "s/://g" * rename "s/\(//g" * rename "s/\)//g" * rename "s/\[//g" * rename "s/\]//g" * rename 's/"//g' * rename "s/'//g" * rename "s/,//g" * rename "y/A-Z/a-z/" * rename "s/---/--/g" * rename "s/-‎--/--/g" * } I use th…

Overly aggresive is right! I don't know if this is genius or deranged! I'm leaning towards genius and stealing the idea. By the way: what's your beef with en dashes? I mean, if it was "everything should be 'HYPHEN-MINUS' (U+002D)", then fine, but why specifically en dashes and not em dashes?

I totally agree that for some people, this could be a terrible command to have around. However, I know that it has been working for me for about 8+ years or so. I almost always run in in my ~/Downloads folder on files that I don't really care about. I download a lot of academic papers and books, and this just saves me a lot of time to put files in the format I like: author--paper-title.pdf. And that's part of the reason why I make all of the dashes the same, so if I'm opening something by an author, I can easily autocomplete and not have to remember how to make other sorts of dashes on the command line.

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

#666

Earlier quoted context omitted.

> Pro tip: rename your development directory (or even better: the workspace path in CI) to put a space and/or special characters in it. The problem with that is that YOUR code may handle it, but your tooling may not. If my code formatter break on spaces, I'm not going to change the formatter.

You could submit a PR to their repo.

I could submit a PR to 5 tools a week on average. I actually have the time and resources to do it once a year.

Last week I opened a ticket for a Firefox bug. Following up on the bug took me 2 hours in total.

FOSS is not free, you pay it with your time. And as with everything you pay for, we all have a budget.

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

#667
post #408

Earlier quoted context omitted.

Using the W functions has been the advice from Microsoft's documentation for ages. But people still use the A functions because they're easier, especially when writing cross-platform software since Windows is the only major OS that made the unfortunate choice of having the base character type 16 bits wide. Fortunately the future of the Windows API does look better since Microsoft has now added proper UTF-8 support si…

I would rather they added a U suffixed version and better still backported that all the way to Win 7. Now in 3-7 years people can write programs that use the A functions, but have to check the version of Windows and refuse to run if it isn't new enough.

There’s been some talk of repurposing the A variants to work on UTF-8

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

#668
post #411

I have an overly-aggressive function in my .bashrc to rename all files in the current directory: # Rename all files in a directory rn() { rename "s/ /-/g" * rename "s/_/-/g" * rename "s/–/-/g" * rename "s/://g" * rename "s/\(//g" * rename "s/\)//g" * rename "s/\[//g" * rename "s/\]//g" * rename 's/"//g' * rename "s/'//g" * rename "s/,//g" * rename "y/A-Z/a-z/" * rename "s/---/--/g" * rename "s/-‎--/--/g" * } I use th…

You missed ~ You really don't want to create a directory named "~".....

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

#669
post #411

I have an overly-aggressive function in my .bashrc to rename all files in the current directory: # Rename all files in a directory rn() { rename "s/ /-/g" * rename "s/_/-/g" * rename "s/–/-/g" * rename "s/://g" * rename "s/\(//g" * rename "s/\)//g" * rename "s/\[//g" * rename "s/\]//g" * rename 's/"//g' * rename "s/'//g" * rename "s/,//g" * rename "y/A-Z/a-z/" * rename "s/---/--/g" * rename "s/-‎--/--/g" * } I use th…

Nice but how do you prevent overwrites? What about directories/folders and the files in that directory/folder? I have: Movie Bla (2020) Movie Bla (2020).mp4 But also: Movie_Bla_(2020) Movie_Bla_(2020).mp4 Movie_Bla_(2020).srt Would not like to lose files like the the srt.

Yeah, sometimes I end up renaming things I don't want to, but it really doesn't happen all that often. And sometimes I throw caution to the wind, add some excitement to my life, and rename a bunch of files (not for anything professional) in some really old directory and hope I don't break anything. But I'm not aiming for perfect with this comment. I just mentioned in another comment, but the vast majority of times I run this is in my ~/Downloads folder on files I don't really worry about breaking.
Post reply on HN