"Relative path" option for PDIR

Nov 2, 2009
302
6
Chile
www.farah.cl
Let's say that I have the following output from pdir:

C:\Users\Miguel\Documents\example>pdir /S/(fpn) *.txt
C:\Users\Miguel\Documents\example\test.txt
C:\Users\Miguel\Documents\example\deeper\cafest.txt
C:\Users\Miguel\Documents\example\deeper\even\matest.txt
C:\Users\Miguel\Documents\example\deeper\even\deeper\tilest.txt


I'd like to have a new option to display the relative path to wherever the disk's current directory is. The output from the above example would become:

C:\Users\Miguel\Documents\example>pdir /S/(fXn) *.txt
.\test.txt
.\deeper\cafest.txt
.\deeper\even\matest.txt
.\deeper\even\deeper\tilest.txt


Thanks.
 
May 29, 2008
572
4
Groton, CT
If you have SED.EXE on your system, you can use this as a workaround:
Code:
pdir /S/(fpn) *.txt |! sed -e "s/%@replace[\,\\,%_cwd]/./g"
E.g.,
Code:
~\Work> pdir /(fpn) *.txt |! sed -e "s/%@replace[\,\\,%_cwd]/./g"
.\2009taxestimate.txt
.\abc.txt
.\activatelist.txt
.\agedatelist.txt
 

Similar threads