script to delete file with exclusion

Discuss and share scripts and script files...
Locked
swan_x
Posts: 313
Joined: 08 Oct 2009 12:27

script to delete file with exclusion

Post by swan_x »

i have a big list of file like this:

Code: Select all

LogSenderTranslation.ar.lng
LogSenderTranslation.bg.lng
LogSenderTranslation.bs.lng
LogSenderTranslation.ca.lng
LogSenderTranslation.cs.lng
LogSenderTranslation.de.lng
LogSenderTranslation.el.lng
LogSenderTranslation.en.lng
LogSenderTranslation.en_AU.lng
LogSenderTranslation.es.lng
i want delete all files, excluding line with ".......en.lng"
so, i have used this script

Code: Select all

delete 0, 0, formatlist(listfolder(, , 1), "F", , "!en.lng", "f")
but this code delete all files ... how to keep en.lng only ?
Last edited by swan_x on 25 Jan 2023 23:00, edited 1 time in total.

highend
Posts: 12222
Joined: 06 Feb 2011 00:33

Re: script to delete file with exclusion

Post by highend »

Is en.lng a real file name? Nope^^

So use "f" and a wildcard...
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

swan_x
Posts: 313
Joined: 08 Oct 2009 12:27

Re: script to delete file with exclusion

Post by swan_x »

sorry my ignorance but with "wildcard" you mean ...?

highend
Posts: 12222
Joined: 06 Feb 2011 00:33

Re: script to delete file with exclusion

Post by highend »

*?
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

swan_x
Posts: 313
Joined: 08 Oct 2009 12:27

Re: script to delete file with exclusion

Post by swan_x »

yes, sorry. i was going to edit my post but you're faster than me!

swan_x
Posts: 313
Joined: 08 Oct 2009 12:27

Re: script to delete file with exclusion

Post by swan_x »

sorry but i can't find a right way ...

with this command

Code: Select all

delete 0, 0, formatlist(listfolder(, , 1), "f", , "*.en.lng", "f")
i have exactly the opposite of what i need

highend
Posts: 12222
Joined: 06 Feb 2011 00:33

Re: script to delete file with exclusion

Post by highend »

And now, inverse the pattern (again) => Done!
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

swan_x
Posts: 313
Joined: 08 Oct 2009 12:27

Re: script to delete file with exclusion

Post by swan_x »

and we are at post number 8.
1 line and 1 answer were enough.
is it possible that you have to weigh your knowledge? is it possible that no one else answers a really stupid question? This is really very frustrating for those who do not know things (like me).
obviously if i knew I wouldn't have wasted my time needlessly begging here. ours is really a beautiful world, populated by really other people. Thank you, i will do it by hand. I'm just sorry to have wasted time unnecessarily humbly asking for help here

highend
Posts: 12222
Joined: 06 Feb 2011 00:33

Re: script to delete file with exclusion

Post by highend »

The formatlist() help file entry contains everything to solve that problem. But as always: Instead of reading that this is at post number 9.

Btw, the inversion was already in your own first post and now you can't even apply that any more?
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

swan_x
Posts: 313
Joined: 08 Oct 2009 12:27

Re: script to delete file with exclusion

Post by swan_x »

anyway problem unsolved

i've read the help on formatlist() but can't find right way for my case
highend wrote: 25 Jan 2023 14:57the inversion was already in your own first post and now you can't even apply that any more?
as already mentioned in my first post, if i use the string of post 1, everything is deleted

you suggest using f and * but how to?

highend
Posts: 12222
Joined: 06 Feb 2011 00:33

Re: script to delete file with exclusion

Post by highend »

I give up. You'll never learn anything even if someone points on it with a fence^^

"!*.en.lng"
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

swan_x
Posts: 313
Joined: 08 Oct 2009 12:27

script to delete file with exclusion - part 2

Post by swan_x »

about my post: viewtopic.php?t=25718
why you have lock the thread? your command does not work for me.
i've already tried the same command, but not work for me.
that's why i still didn't understand ...

i've run:

Code: Select all

delete 0, 0, formatlist(listfolder(, , 1), "F", , "!*.en.lng", "f")
but still all files in the list are deleted

highend
Posts: 12222
Joined: 06 Feb 2011 00:33

Re: script to delete file with exclusion - part 2

Post by highend »

"F"

SERIOUSLY?
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

swan_x
Posts: 313
Joined: 08 Oct 2009 12:27

Re: script to delete file with exclusion - part 2

Post by swan_x »

ok thank you. it work

i want write here the right final code, for other users who may have the same needs as me

Code: Select all

delete 0, 0, formatlist(listfolder(, , 1), "f", , "!*.en.lng", "f")

Locked