Olyno / skent

Manage your files and folder with Skript
GNU General Public License v3.0
11 stars 2 forks source link

if file name #45

Closed VisoXC closed 10 months ago

VisoXC commented 10 months ago

Describe your idea

I think there should be a function to do:

if dir/file name is (not) "<name>":

That would make mass handeling files/directories so much easier!

Olyno commented 10 months ago

I'm confused, what this syntax should do?

VisoXC commented 10 months ago

If you, for an example loop all files in a directory, you could filter out specific ones.

command /test:
    trigger:
        loop all files in dir path "test":
            if loop-value's name is "test1" or "test2":
                add loop-value to {_test}
                send "%{_test}%"

Or, if you want to reset a plugin, but want to keep a file called "file.dat":

command /nomorecoolplugin:
    trigger:
        loop all files in dir path "plugins\coolplugin":
            if loop-value's name is not "file.dat":
                delete file path loop-value

PS: I didn't check for mistakes in the code.

Olyno commented 10 months ago

You can already get the name of a file using this syntax: https://skripthub.net/docs/?id=8081

Remember that if some syntaxes are really specific, it is mainly because it creates conflicts with existing syntaxes in Skript.