Skip to main content

Timeline for I HATE spaces in file names

Current License: CC BY-SA 3.0

10 events
when toggle format what by license comment
Jun 17, 2020 at 9:04 history edited CommunityBot
Commonmark migration
Aug 12, 2014 at 7:57 comment added mikeserv @M.Herzkamp perhaps valid, but still crazy. Dont golf your fs - there are too many sandtraps.
Aug 12, 2014 at 7:50 comment added M.Herzkamp On further reflection, my earlier judgement seems to be unjustified. The challenge says that you can either remove spaces or replace them with an underscore. However, it does not mention that it has to be done consistently. If you chose to replace some spaces and remove others, it seems to be a valid solution. +1
Aug 12, 2014 at 5:45 comment added mikeserv @Gilles - but by the way, it is not a quirk - it is an intended and standards-controlled behavior. The Field-Splitting section is among the very few in the shell spec that does not contain the words unspecified or implementation-defined. There are no such guarantees with zsh's builtin function zmv for instance.
Aug 11, 2014 at 17:56 history edited mikeserv CC BY-SA 3.0
added 197 characters in body
Aug 11, 2014 at 17:50 comment added mikeserv @Gilles - my preference would be to use sh -c 'mkdir -p ../newtree/"$0"; ln "$0"/* ../newtree/$0 {} \; and other globs on a find -type d command to create a mirrored tree of hardlinks and then to operate on those, but I'm second-guessing writing a code-golf at all for a move operation. Good point about the leading/trailing spaces, though I think that is also a behavior I would prefer.
Aug 11, 2014 at 16:26 comment added Gilles 'SO- stop being evil' This doesn't rename files inside directories whose names contain spaces. A fix would be to replace -exec with -execdir. Ånother quirk of IFS that you aren't mentioning is that trailing spaces are deleted. Note that as others have noticed you need the -T option to mv as well, for when the target of an mv call is an existing directory.
Aug 11, 2014 at 12:08 comment added mikeserv @M.Herzkamp - ifs behaves differently depending on whether it is set to whitespace or not. Most people hate it because they do not understand its two primary qualities - that it only operates on expansions ($expand not (ex pand)) and the ifsws thing just mentioned. Look here
Aug 11, 2014 at 11:44 comment added M.Herzkamp This works on my test set as you intended, but not as the challenge requires. I like it, though, because I will probably learn something new. I guess I will have to read up on this IFS magic thingy...
Aug 9, 2014 at 11:40 history answered mikeserv CC BY-SA 3.0