More on pdir's options: /(fq)

#1
The /(fq) option is rather useful, but... the fact that it only quotes what needs to be quoted can be annoying. For example:

servero 0 C:\Users\Miguel\Documents>pdir /(dymd thms z fpnq)
20130828 165242 <DIR> C:\Users\Miguel\Documents\ChileIndomito
20130828 165516 <DIR> C:\Users\Miguel\Documents\fonts
20130914 214247 <DIR> "C:\Users\Miguel\Documents\Plantillas personalizadas de Office"
20130829 123458 <DIR> C:\Users\Miguel\Documents\viejasPeladoras
....
20131016 175322 116 C:\Users\Miguel\Documents\qc.btm
20131016 183259 2045358 C:\Users\Miguel\Documents\tcc.txt


It's not immediately obvious here, as the formatting is lost, but the quoted file is "pushed" one column to the right.

Trying /("fpn") or /(\"fpn\") doesn't work. Currently, when I need to, I use /(«fpn») but then my friends hate me for it, as they can't type either of those characters. /('fpn') works, but it's rather problematic («'» is a valid character for a file name).

Before posting on the uservoice forum, I'd like to test the waters here first for an idea of mine: a new /(fQ) option that will enclose the filename in quotes always. That way, the output from my example would be:

servero 0 C:\Users\Miguel\Documents>pdir /(dymd thms z fpnQ)
20130828 165242 <DIR> "C:\Users\Miguel\Documents\ChileIndomito"
20130828 165516 <DIR> "C:\Users\Miguel\Documents\fonts"
20130914 214247 <DIR> "C:\Users\Miguel\Documents\Plantillas personalizadas de Office"
20130829 123458 <DIR> "C:\Users\Miguel\Documents\viejasPeladoras"
....
20131016 175322 116 "C:\Users\Miguel\Documents\qc.btm"
20131016 183259 2045358 "C:\Users\Miguel\Documents\tcc.txt"


What do you think?

 
#2
I just defined a function
function relfile=`%@quote[%@replace[%_cwds,,%@full[%&]]]`
and in the PDIR command I use
@relfile[*]

instead of fpnq.

Note that the
@quote is needed only to make the field quoted when required, and the @full
is only is usefule only when the function argument is other than the special "*" of PDIR.

BTW, a variant of the function could be used for your "always quoted" issue in your other thread. by defining the relfile function with actual quotation marks instead of the @QUOTE function:
function relfile=`"%@replace[%_cwds,,%@full[%&]]"`
--
HTH, Steve
 
#3
I just defined a function
function relfile=`%@quote[%@replace[%_cwds,,%@full[%&]]]`
and in the PDIR command I use
@relfile[*]
instead of fpnq.
Note that the @quote is needed only to make the field quoted when required, and the @full
is only is usefule only when the function argument is other than the special "*" of PDIR.



I've just tried this, and the results aren't what I expected:

c:\users\miguel\documents>function relfile=`%@quote[%@replace[%_cwds,,%@full[%&]]]`

c:\users\miguel\documents>pdir /(dymd thms z @relfile[*])
20130828 165242 <DIR> "&"
20130828 165516 <DIR> "&"
20130914 214247 <DIR> "&"
20130829 123458 <DIR> "&"
20130726 174617 1042986 "&"
20130723 144906 2461354 "&"
20130803 162236 151904890 "&"
20130803 163848 510374942 "&"
20030309 133407 200554 "&"
20131016 182802 2050468 "&"
20130829 095019 111608927 "&"
20131016 175322 116 "&"
20131016 183259 2045358 "&"

c:\users\miguel\documents>echo %@relfile[java.txt]
"&"

c:\users\miguel\documents>unfunction relfile

c:\users\miguel\documents>function relfile=`%@quote[%@replace[%_cwds,,%@full[%%&]]]`

c:\users\miguel\documents>pdir /(dymd thms z @relfile[*])
20130828 165242 <DIR> "&"
20130828 165516 <DIR> "&"
20130914 214247 <DIR> "&"
20130829 123458 <DIR> "&"
20130726 174617 1042986 "&"
20130723 144906 2461354 "&"
20130803 162236 151904890 "&"
20130803 163848 510374942 "&"
20030309 133407 200554 "&"
20131016 182802 2050468 "&"
20130829 095019 111608927 "&"
20131016 175322 116 "&"
20131016 183259 2045358 "&"

c:\users\miguel\documents>echo %@relfile[java.txt]
"&"

c:\users\miguel\documents>



Am I doing something wrong?
 
#4
Sorry, my mistake - I never switched to the CMD-style ParameterChar from the 4DOS-style one. The ampersand "&" character should be the dollar sign "$". (For the other ones I use the ppseudovariables %= and %+, which work everywhere.)
--
Steve