Script that will select files with a certain extension?

Discuss and share scripts and script files...
Post Reply
Famin3
Posts: 2
Joined: 07 Jul 2009 04:37

Script that will select files with a certain extension?

Post by Famin3 »

Hi there. I'm basically looking for a script that will use a hotkey to select all the files with specific user defined file extensions within one folder. The reason being I want to delete downloaded files in multiple .rar files after being extracted.

ie, one hotkey selects all .rar, .sfv, etc... in a single active folder.

Anything that currently does this? Thank you.

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Script that will select files with a certain extension?

Post by serendipity »

Famin3 wrote:Hi there. I'm basically looking for a script that will use a hotkey to select all the files with specific user defined file extensions within one folder. The reason being I want to delete downloaded files in multiple .rar files after being extracted.

ie, one hotkey selects all .rar, .sfv, etc... in a single active folder.

Anything that currently does this? Thank you.
Hi and Welcome to the Club,
Go to menu "User | Manage Commands" and click on Category "Run script". On the right, click new and add new command, now copy/paste the following in the Script field below:
input $filter, "Enter pattern to select", "*.rar|*.sfv"; selfilter $filter;

And finally, assign your shortcut from the button "Assign Keyboard shortcut".

Tip: easier way without all this hassle would be to, select the extensions (one of each extension type is enough) and press ctrl+alt+j . This will show only those extensions you selected, now select all files (ctrl+a) and delete.

Famin3
Posts: 2
Joined: 07 Jul 2009 04:37

Re: Script that will select files with a certain extension?

Post by Famin3 »

Hey thanks heaps! I actually modified your script there so that theres no popup box and also to include more of the rar files.

Code: Select all

set $filter, "*.rar|*.sfv|*.r00|*.r01|*.r02|*.r03|*.r04|*.r05|*.r06|*.r07|*.r08|*.r09|*.r10|*.r11|*.r12|*.r13|*.r14|*.r15|*.r16|*.r17|*.r18|*.r19|*.r20|*.r21|*.r22|*.r23|*.r24|*.r25|*.r26|*.r27|*.r28|*.r29|*.r30|*.r31|*.r32|*.r33|*.r34|*.r35|*.r36|*.r37|*.r38|*.r39|*.r40|*.r41|*.r42|*.r43|*.r44|*.r45|*.r46|*.r47|*.r48|*.r49|*.r50|*.r51|*.r52|*.r53|*.r54|*.r55|*.r56|*.r57|*.r58|*.r59|*.r60|*.r61|*.r62|*.r63|*.r64|*.r65|*.r66|*.r67|*.r68|*.r69|*.r70|*.r71|*.r72|*.r73|*.r74|*.r75|*.r76|*.r77|*.r78|*.r79|*.r80|*.r81|*.r82|*.r83|*.r84|*.r85|*.r86|*.r87|*.r88|*.r89|*.r90|*.r91|*.r92|*.r93|*.r94|*.r95|*.r96|*.r97|*.r98|*.r99"; selfilter $filter;
This works wonders for deleting lots of left over rar files!

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Script that will select files with a certain extension?

Post by TheQwerty »

You could even go a step further and use wildcards to shorten that:

Code: Select all

set $filter, "*.rar|*.sfv|*.r##"; selfilter $filter;

admin
Site Admin
Posts: 66075
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Script that will select files with a certain extension?

Post by admin »

TheQwerty wrote:You could even go a step further and use wildcards to shorten that:

Code: Select all

set $filter, "*.rar|*.sfv|*.r##"; selfilter $filter;
You could even omit the variable:

Code: Select all

selfilter "*.rar|*.sfv|*.r##";
Also note that the "|" separator is only necessary when you have ";" in the patterns (which should be very rarely the case in real life). So this more familiar looking syntax works just as well:

Code: Select all

selfilter "*.rar;*.sfv;*.r##";

fishgod
Posts: 231
Joined: 03 Feb 2008 00:40
Location: Sankt Augustin (near Bonn), Germany

Re: Script that will select files with a certain extension?

Post by fishgod »

serendipity wrote:... now select all files (ctrl+a) and delete.
You can also automate this by using the following script:

Code: Select all

#250; //select all items (Edit | Select All)
#169; //delete selected files (File | Delete)
Operating System: Win10 x64 / Win11 x64 / almost allways newest XY-beta
totally XYscripting-addicted

Pagat
Posts: 306
Joined: 09 Oct 2007 21:23
Location: Austria

Re: Script that will select files with a certain extension?

Post by Pagat »

and to combine this in only one command you could also use this:

Code: Select all

::delete 1, 0, "<curpath>\*.r?? | <curpath>\*.sfv";
Only downside here is, that you can't use "##" to delete only numbers but you have to use "??" which would also delete ".rxy"...

Post Reply