I need to know how I can get the subfolders and files that are in a specified directory and save them in an array of type string
string[] rutas = {};
string path = "/path/sub_path/folder/";
File file = File.new_for_path (path);
/*
* En esta parte quiero guardar el contenido de la ruta especificada en el array
* Ejemplo:
* /home/user/carpeta
* /home/user/archivo1
* /home/user/texto.txt
* /home/user/otro_texto.txt
* etc.
*/
Use
GLib.Dir.open (directorio, 0)
to open and get access to the directory, then loopwhile
the methodread_name ()
to get the list of directories, example:You can also define the type of file it is, use the method
FileUtils.test
to get the comparison.}