Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: RPi keeps replacing spaces in file names with "%20"

Tue Aug 05, 2014 3:23 pm

RaTTuS wrote:having leading - in files names is a crime against humanity ... see also leading / trailing spaces
never create a file called
-rf
... ...
While annoying, this, too, is manageable, by getting in the habit of always using the "--" trick to block out interpreting variables as options. Note that this is fine in the modern GNU world, but many vendor-supplied tools don't recognize "--", which is a problem.

I've been doing a fair amount of programing in Tcl lately, and for some reason this issue arises frequently in Tcl programs. You quickly get in the habit of using "--" whenever applicable.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

miauriel
Posts: 12
Joined: Mon Jul 21, 2014 1:36 am

Re: RPi keeps replacing spaces in file names with "%20"

Tue Aug 05, 2014 7:23 pm

Just out of curiosity here.... Is there a program that I can use to run through and do a find and replace command for file names? If that is the case, I could just do two runs (R1-"%20"->"_", R2- " "->"_") and be done with this. :?:

DirkS
Posts: 10362
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: RPi keeps replacing spaces in file names with "%20"

Tue Aug 05, 2014 9:54 pm

miauriel wrote:Just out of curiosity here.... Is there a program that I can use to run through and do a find and replace command for file names? If that is the case, I could just do two runs (R1-"%20"->"_", R2- " "->"_") and be done with this. :?:
Googled 'linux replace %20 in filename' and found http://ubuntuforums.org/showthread.php?t=1218113 and loads more
I think there are also some examples that can do it recursively

Gr.
Dirk.

User avatar
jojopi
Posts: 3268
Joined: Tue Oct 11, 2011 8:38 pm

Re: RPi keeps replacing spaces in file names with "%20"

Wed Aug 06, 2014 12:40 am

Joe Schmoe wrote:While annoying, this, too, is manageable, by getting in the habit of always using the "--" trick to block out interpreting variables as options. Note that this is fine in the modern GNU world, but many vendor-supplied tools don't recognize "--", which is a problem.
If the arguments you are dealing with are filenames, then I think the "./*" convention is better and more portable than the "-- *" convention. The main place I use "--" is in deliberate word-splitting, such as:

Code: Select all

line="date time operation"
set -- $line
echo "$3 at $1T$2"
Not sure about tickle.

Return to “General discussion”