More on pdir's options: /(fq)

Nov 2, 2009
294
6
Chile
www.farah.cl
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?

 
May 20, 2008
3,515
4
Elkridge, MD, USA
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
 
Nov 2, 2009
294
6
Chile
www.farah.cl
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?
 
May 20, 2008
3,515
4
Elkridge, MD, USA
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
 
Similar threads
Thread starter Title Forum Replies Date
Charles Dye More help nits Support 0
L detach /Q is more yappy than advertised Support 3
vefatica WAD More SET /A woes Support 4
D TCC has much more elegant ways for usebackq. What ways? Support 12
vefatica Make FFIND a bit more friendly? Support 14
vefatica More on the help Support 12
nikbackm WAD More Windows 10 woes Support 8
fromano How to? Everything finding directories with 2 or more files in them Support 3
vefatica WAD More on ACTIVATE Support 4
vefatica More on IFTP Support 7
Dan Glynhampton Documentation v15 help: More mailto: links Support 2
Dan Glynhampton Documentation v15 help: More odd mailto: links in the help Support 8
C Looking for files with more than 1 period Support 2
vefatica More on the installer Support 5
J DebugMonitor - More mystical than magnets? Support 6
D "Learn More" button on home page not working Support 3
J Colors in tcmd (one more try) Support 1
M More SafeChars type issues... Support 4
Y More v13 weirdness Support 4
S More HELP nits Support 5
vefatica WINDOW (and more closing TCC woes) Support 15
Jay Sage More on Problem with Tabbed Toolbar Support 0
Roedy more.com stops working Support 1
dcantor More date-related help items for V11 Support 0
Jay Sage More Problems with TCTOOLBAR Support 0
vefatica @IPNAME (and more) Support 2
M More file-renaming problems involving commas... Support 0
R Reading an Unicode file with more than 8191 lines Support 1
Phileosophos PDIR to list filenames without extensions? Support 2
vefatica PDIR and streams Support 1
vefatica PDIR with fixed-width unqualified filename? Support 2
W pdir returns diff results between tcc and tcmd - one is an error msg Support 5
thedave pdir /s Support 2
Emilio III pdir /f switch Support 1
D pdir ignores pm Support 2
WadeHatler pdir broken in 19.1 for directories with spaces Support 1
M WAD PDir not working correctly... Support 5
vefatica WAD Nested variable expansion in PDIR's @function[*]? Support 13
mfarah How to? Getting pdir to display relative paths. Support 2
S PDIR and @LABEL questions Support 4
M How to? PDir on multiple wildcard patterns... Support 2
A pdir function usage Support 3
T How to? dir/pdir - 2nd level down only Support 7
JohnQSmith PDIR and descriptions Support 21
G WAD PDIR @IF bug, @WORD bug Support 8
S WAD PDIR: files with percent sign % in name cause not listing other files in directory Support 9
S WAD PDIR ignores exclusion ranges Support 1
M PDir format question... Support 3
M How to? "PDir" not working the way the I _thought _ the documentation said it does… Support 8
S WAD /Sn mishandled in DIR and PDIR, possibly elsewhere Support 15

Similar threads