1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Directory Management

Discussion in 'Scripts' started by Veraid, Mar 3, 2020.

  1. Veraid

    Veraid Member

    Joined:
    Feb 8, 2017
    Messages:
    25
    Likes Received:
    8
    Expressions:
    [all] file[\s] (of|at) [directory] %string% [with [extension] %string%]

    Returns files in a directory, if you add the [all] it will also search all directories in the directory. The extension is what file types it returns for example "sk" would only return skript files by default it finds everything including directories. You can set the extension to <FILES> if you want to only search for files or <DIRECTORIES> if you only want to search directories
    delete file[\s] [(of|at)] [directory] %string%
    Delete a specific file or if you point the string to a directory it will delete all files within that directory, it will also remove the directory if after removing all files the directory is empty (meaning if there is a folder within the folder it will not delete that content)
    create file [(of|at)] %string% [with [text] %string%]
    Create a file, optionally set the text of the file too
    create directory [(of|at)] %string%
    Creates a empty directory at the location
    scripts
    This returns all valid scripts in your scripts folder, this does not include scripts prefixed with "-"

    Requires apache commons-io-2.6 (included in download)
    file text [(of|at)] %string%

    Returns text of a file

    This also adds 2 functions:
    files(directory,extension)
    directories(directory,extension)

    Examples:
    Code (Text):
    1. command /createfile:
    2.   trigger:
    3.     create file "plugins\Skript\scripts\emptyscript.sk" with "#This is an empty script%nl%#I should add some content here..."
    4.     #creates emptyscript.sk in your scripts folder and writes to it, %nl% would require skquery but adds a new line
    5. command /deletefile:
    6.   trigger:
    7.     delete file "plugins\Skript\scripts\emptyscript.sk"
    8.     #deletes emptyscript.sk in your scripts folder
    9. command /mypluginjars:
    10.   trigger:
    11.     send files at directory "plugins\" with "jar"
    12.     #returns all jar files in your plugins folder
    13. command /alljars:
    14.   trigger:
    15.     send all files at directory "plugins\" with "jar"
    16.     #returns all jar files in directories after your plugins folder, meaning this will also return skript-mirror jars in the skript-mirror folder

    Requirements:

    Skript-Mirror
     

Share This Page

Loading...