Page 1 of 1

script to delete file with exclusion

Posted: 25 Jan 2023 09:16
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 ?

Re: script to delete file with exclusion

Posted: 25 Jan 2023 09:31
by highend
Is en.lng a real file name? Nope^^

So use "f" and a wildcard...

Re: script to delete file with exclusion

Posted: 25 Jan 2023 10:16
by swan_x
sorry my ignorance but with "wildcard" you mean ...?

Re: script to delete file with exclusion

Posted: 25 Jan 2023 10:24
by highend
*?

Re: script to delete file with exclusion

Posted: 25 Jan 2023 10:30
by swan_x
yes, sorry. i was going to edit my post but you're faster than me!

Re: script to delete file with exclusion

Posted: 25 Jan 2023 14:16
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

Re: script to delete file with exclusion

Posted: 25 Jan 2023 14:30
by highend
And now, inverse the pattern (again) => Done!

Re: script to delete file with exclusion

Posted: 25 Jan 2023 14:47
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

Re: script to delete file with exclusion

Posted: 25 Jan 2023 14:57
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?

Re: script to delete file with exclusion

Posted: 26 Jan 2023 09:35
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?

Re: script to delete file with exclusion

Posted: 26 Jan 2023 09:51
by highend
I give up. You'll never learn anything even if someone points on it with a fence^^

"!*.en.lng"

script to delete file with exclusion - part 2

Posted: 26 Jan 2023 14:38
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

Re: script to delete file with exclusion - part 2

Posted: 26 Jan 2023 14:42
by highend
"F"

SERIOUSLY?

Re: script to delete file with exclusion - part 2

Posted: 26 Jan 2023 17:00
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")