Check for Files in the Install Directory

I'm looking to commission a script that will check the install directory for a specific file and set a variable that I can later check through a script call.

My instinct says that this wouldn't be too difficult a script to implement. What say you, esteemed coder?
to check for the existance of a file, you don't need a script - it's a single script command that does this. Check the script call topics for that - I don't remember how that command is spelled right now, but I know it has been asked and answered already.
Take a look at FileTest: http://ruby-doc.org/core-1.8.7/FileTest.html

I don't know, if the ruby version is the correct one for VX Ace, but most of these methods should work.
Thanks guys!
It is. From the help file:

A module containing file test functions.

Module Functions

FileTest.exist?(filename)

Returns true if filename exists.

FileTest.directory?(filename)

Returns true if filename is a directory.

FileTest.file?(filename)

Returns true if filaname is an ordinary file.

FileTest.size(filename)

Returns the size of filename. If filename does not exist, throws an Errno::EXXX exception (most likely Errno::ENOENT).
Tried to run it through a conditional branch, but I'm getting uninitialized constant error. Would I have to run this through a script?

Bear with me. I'm trying to learn 🙂
Tried to run it through a conditional branch, but I'm getting uninitialized constant error.
Please give a screenshot of the exact command you used - that rather sounds as if you have an excess space or some other syntax error that prevents the interpreter from identifying the command.
Ok, now I checked for a different file and got this error:

error_zps3m70n68s.png


Here's my conditional branch:

error1_zpshtff2bje.png


I'm just checking for the existence of the Audio file for experimentation purposes 🙂
The command Filetest.exists? requires a string with the name of the file to test, but

Audio

is not a string, it's either a variable or a constant - that's why it doesn't work

Try

Filetest.exists?('Audio')instead, that is a string.

Also, don't forget file extension - 'Audio' is only the correct name if the file has no extension, most files have (like 'Audio.mp3')
I was able to make this work in the Conditional Branch:

File.exists?("C:\\Users\\Owner\\Documents\\Deez Notes.txt")

The reason for the double-backslashes is because a single backslash will be interpreted as a control character along with the next character, leading to an error.

You can also store it in a Switch: $game_switches[76] = File.exists?("C:\\Users\\Owner\\Documents\\Canvas Notes.txt")

Wouldn't have been able to get this right without Andar's and Iavra's advice so big thanks go to them.
The path is only neccessary if the file is stored somewhere other than the main project folder. By default the command checks that folder (where the game.exe had been started in)
The reason for the double-backslashes is because a single backslash will be interpreted as a control character along with the next character, leading to an error.
You can also use forward-slashes:

Code:
File.exists?("C:/Users/Owner/Documents/Deez Notes.txt")
You guys rock! I'll try this out later 🙂

EDIT: It all works perfectly. Thank you guys 🙂

Original thread: https://forums.rpgmakerweb.com/threads/check-for-files-in-the-install-directory.39780/