List files with exclusion

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
timle
Pro Scripter
Posts: 96
Joined: Tue Apr 20, 2004 5:53 am

List files with exclusion

Post by timle » Tue Oct 29, 2019 6:03 pm

Hello,
I have a folder containing these files:

text_a.pdf
text_b.pdf
text_d.pdf
text_x.pddf
how can I get a return of filelist excluding the X file.
I can sort and copy all files with out X to a folder and get filelist of that folder, but there should be a more efficient way of doing it

Thank you

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: List files with exclusion

Post by JRL » Tue Oct 29, 2019 10:00 pm

This help?

Code: Select all

Let>vPath=%userdocuments_dir%\PDF_Files
.
Let>RP_Wait=1
Let>RP_Windowmode=0
RunProgram>cmd /c dir "%vPath%\*.*" | find /V /I "_x" | clip
GetClipboard>vData
MDL>vData

timle
Pro Scripter
Posts: 96
Joined: Tue Apr 20, 2004 5:53 am

Re: List files with exclusion

Post by timle » Tue Oct 29, 2019 10:05 pm

Thank you I will try it, does it work if I want to exclude X and Y for example?

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: List files with exclusion

Post by JRL » Wed Oct 30, 2019 12:37 pm

Just add another "find". Type "DOS find" into your favorite search engine for more info.

Code: Select all

Let>vPath=%userdocuments_dir%\PDF_Files
.
Let>RP_Wait=1
Let>RP_Windowmode=0
RunProgram>cmd /c dir "%vPath%\*.*" | find /V /I "_x" | find /V /I "_y" | clip
GetClipboard>vData
MDL>vData

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Re: List files with exclusion

Post by armsys » Thu Oct 31, 2019 7:30 am

Hi JRL,
May I know the meaning of the dot in Line 2? A comment/remark line?

Code: Select all

Let>vPath=%userdocuments_dir%\PDF_Files
.
Thanks.

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: List files with exclusion

Post by JRL » Thu Oct 31, 2019 1:37 pm

Perhaps a symbol of anarchy? A dot hidden between the lines of code to remind the proletariat to stay strong? OR, way more likely, a way to provide white space in the code since the (code) (/code) html function removes blank lines.

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Re: List files with exclusion

Post by armsys » Thu Oct 31, 2019 8:16 pm

Hi JRL,
Oh! Previously thought you've discovered an undocumented new feature. It turns out to be a white space. Thanks JRL.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts