Filenames with weird characters in them

This is the important part of the code/flow:

(Need fs-ops-move node)

[{"id":"11f8a8d.dd42957","type":"function","z":"26262ba1.62dcbc","g":"c73138f5.6f42f","name":"build msg","func":"msg.spath = \"/home/me/.node-red/public/\";\nmsg.dpath = \"/home/me/.node-red/public/history/\";\n\nmsg.payload = \"Powered on at \" + msg.payload + \".db\";\nnode.status(msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":4700,"y":240,"wires":[["ad90ee9d.430698"]]},{"id":"ad90ee9d.430698","type":"fs-ops-move","z":"26262ba1.62dcbc","g":"c73138f5.6f42f","name":"","sourcePath":"spath","sourcePathType":"msg","sourceFilename":"uptime.txt","sourceFilenameType":"str","destPath":"dpath","destPathType":"msg","destFilename":"payload","destFilenameType":"msg","link":false,"x":4850,"y":240,"wires":[[]]}]

So why is it generating files like this:

All the ' at the start and end of the names.

All the ' at the start and end of the names.

and at the end.

Actually, i found this myself as well, got frustrated, thought something was wrong with my scripts causing these quotes, but no, apparently it is caused by the shell itself, there is some setting (quote styling) that has been turned on in GNU utils by default since some version.

If you use: ls --quoting-style=literal you will see that the quotes disappear,

edit - i just see that you use some 'exotic' lf commands (never heard of this), this could also be the cause for the default use of quotes.

1 Like

Ah, sorry, the lf is only my way (lazy) way of doing a specific ls command.

I have a few to do specific things rather than remembering to type all the qualifiers.

But thanks.

I'm not going mad. (I probably already am, so.....)

ok in that case you can do:

cd 
nano .bashrc

add this at the bottom:

export QUOTING_STYLE=literal

ctrl+x y to save
exit the terminal and start a new connection, then it should be gone.

I edited my .bash_alias file to have this line now.

alias lf='ls -F --group-directories-first --quoting-style=literal'

Works like a charm.

1 Like

I guess that would work too.

I may go that way actually.

The quotes are because the filename includes spaces. When entering filenames with spaces you have to quote the name (or escape the spaces) and the default with ls is to do the same. If they were not quoted you might think you have a file called Powered and another call on. I know it is obvious in the case you show, but might not be in other cases, particularly if you started adding mulitple spaces. Suppose for example the directory contained just one file called
Powered on at 2021-02-212108.db Powered on at ....
Without the quotes it is unclear whether there is one file or two.

1 Like

Appreciated.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.