Main Menu

Finding file directory

Started by at large 0010, Sep 27, 2020, 11:37 PM

Previous topic - Next topic

at large 0010

I'm trying to find the directory path of file running but it seems as though I have to already know the path of the file using fs.getDir(). My file is in a directory like "dir/dir/myFile" and I was trying to use "fs.getDir("myFile")", my hopes was that it would return something like "dir/dir/" but alas, it did not work. Any ideas?

Lupus590

This will do what you want.

fs.getDir(shell.getRunningProgram())

fs.getDir needs a file path, shell.getRunningProgram gets the full file path of the file, passing this to getDir gives the result that you want.