Timeline for How can I delete a file which filename has non-printing characters
Current License: CC BY-SA 3.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 13, 2012 at 4:37 | history | edited | Kevin | CC BY-SA 3.0 | added 108 characters in body |
| Jan 13, 2012 at 4:32 | comment | added | Peter.O | The notation varies, depending on the environment.. just as in some environments 0xFF is valid as a hex value, and others may require \xFF... or even just FF.. or U+00FF ... | |
| Jan 13, 2012 at 4:18 | comment | added | Kevin | @perer That crossed my mind, but shouldn't it have a 0 in front? | |
| Jan 13, 2012 at 4:12 | comment | added | Peter.O | .. another point.. you've referred to the 177 as decimal.. It is an octal value (the decimal value is 127) | |
| Jan 13, 2012 at 3:34 | comment | added | Kevin | @perer Yes, I just noticed that. I added -n to get rid of the newline. | |
| Jan 13, 2012 at 3:33 | history | edited | Kevin | CC BY-SA 3.0 | added 1 characters in body |
| Jan 13, 2012 at 3:29 | comment | added | Peter.O | Your echo, as-is, sends 2 file names to xargs, and then on to rm... the second file name is \n.. This results in either an error, or deleting a file of that name ('\n') | |
| Jan 13, 2012 at 3:18 | comment | added | Mr Moose | I'm using bash on SunOS and when I tried your command, I got xargs: illegal option -- 0. I looked at the man page and couldn't see an option for null termination. I managed to get a fix for the issue now though. See the response marked as answer. | |
| Jan 13, 2012 at 2:02 | comment | added | Kevin | @MrMoose \xb1 is decimal 177, \0 null-terminates it, and -0 tells xargs to take a null-terminated name instead of a newline-terminated one. | |
| Jan 13, 2012 at 1:57 | comment | added | Mr Moose | Are you saying that \xb1\0 is the hex representation of \177? | |
| Jan 13, 2012 at 1:52 | history | answered | Kevin | CC BY-SA 3.0 |