filter files ending in 'L'

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
kotlmg
Posts: 298
Joined: 30 Jun 2010 17:14

filter files ending in 'L'

Post by kotlmg »

hello sir,
how to filter files ending in letter 'L' and send them to 'L' folder?

with regards,
kotlmg

jaywalker32
Posts: 205
Joined: 27 May 2014 05:24

Re: filter files ending in 'L'

Post by jaywalker32 »

Code: Select all

moveto("L", quicksearch(">(L)\.[^.]+$ /nc");
This should work.

The \.[^.]+$ will match any extension.

/n switch the restrict search to exclude subfolders
/c switch will make it case-sensitive

Run this first to make sure you're selecting the correct files:

Code: Select all

text quicksearch(">(L)\.[^.]+$ /nc");

kotlmg
Posts: 298
Joined: 30 Jun 2010 17:14

Re: filter files ending in 'L'

Post by kotlmg »

thanks for your script.
moveto("L", quicksearch(">(L)\.[^.]+$ /nc");
with above script, i am getting the error, the destination you have selected doen't exist. couldn't create new path. the file operation will not happen.

highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: filter files ending in 'L'

Post by highend »

And in which directory are you, when you execute the command?

Btw, the command isn't syntactically correct. It's missing an ending
")" but even more so, it shouldn't use them at all. It's not a function,
it doesn't has a return value.

Code: Select all

moveto "L", quicksearch(">(L)\.[^.]+$ /nc");
One of my scripts helped you out? Please donate via Paypal

kotlmg
Posts: 298
Joined: 30 Jun 2010 17:14

Re: filter files ending in 'L'

Post by kotlmg »

i am in folder D:\Partronics eboards Pvt.Ltd\IPIS\Wav Files\Digits - Copy\.

i am getting the error "the following items does not exist."
it is giving script error.

highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: filter files ending in 'L'

Post by highend »

Screenshot of that error. If that folder really has write access it shouldn't fail to create a subfolder
One of my scripts helped you out? Please donate via Paypal

kotlmg
Posts: 298
Joined: 30 Jun 2010 17:14

Re: filter files ending in 'L'

Post by kotlmg »

screenshots attached herewith.
Attachments
2019-11-18_214922.png
2019-11-18_214922.png (19.46 KiB) Viewed 2069 times
2019-11-18_214901.png
2019-11-18_214901.png (45.29 KiB) Viewed 2069 times

highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: filter files ending in 'L'

Post by highend »

Use the correct script call from viewtopic.php?p=174303#p174303
...
One of my scripts helped you out? Please donate via Paypal

kotlmg
Posts: 298
Joined: 30 Jun 2010 17:14

Re: filter files ending in 'L'

Post by kotlmg »

it is not working

highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: filter files ending in 'L'

Post by highend »

Ok. Show the belonging screen shots of the error message you're getting after using
the command I posted above...
One of my scripts helped you out? Please donate via Paypal

kotlmg
Posts: 298
Joined: 30 Jun 2010 17:14

Re: filter files ending in 'L'

Post by kotlmg »

error messages enclosed herewith.
Attachments
2019-11-18_231513.png
2019-11-18_231513.png (49.1 KiB) Viewed 2059 times
2019-11-18_231504.png
2019-11-18_231504.png (26.23 KiB) Viewed 2059 times

highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: filter files ending in 'L'

Post by highend »

Then either use this:
moveto "L", replace(quicksearch(">(L)\.[^.]+$ /nc"), <crlf>, "|");

or update to at least v20.50.0201
One of my scripts helped you out? Please donate via Paypal

kotlmg
Posts: 298
Joined: 30 Jun 2010 17:14

Re: filter files ending in 'L'

Post by kotlmg »

the above script worked perfectly.
thanks a lot.

kotlmg
Posts: 298
Joined: 30 Jun 2010 17:14

Re: filter files ending in 'L'

Post by kotlmg »

moveto "L", replace(quicksearch(">(L)\.[^.]+$ /nc"), <crlf>, "|");

hello sir,
how to extend the above script to files ending in 'A'/'B'/'C'/..'Z'
A should go to A folder.
B should go to B folder.
..
Z should go to Z folder.

with regards,
kotlmg

highend
Posts: 13317
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: filter files ending in 'L'

Post by highend »

Not possible with a single line. Use a while loop and iterate over all chars from A-Z,
find the files that match that ending char with regexmatches and execute the
moveto for these "blocks of files"
One of my scripts helped you out? Please donate via Paypal

Post Reply