I have created a method for deleting directories in which
g_file_measure_disk_usage() (see documentation link) is used at the first place to find out if the directory to be deleted is empty or not. If it is not empty, my program shows a query if the directory should be really deleted. If the user answers “yes”, my code steps through the directory content and removes contained files by calling
g_file_delete() for each children item, and finally the directory to be removed is deleted also.
Problem: When being connected to a remote directory, for example via ssh,
g_file_measure_disk_usage() returns the following error message:
Operation not supported for the current backend.
Now I am asking myself how to check for remote connections that the directory is empty or not. And furthermore, I wonder how to delete the directory via
g_file_delete because in the documentation it is said that
fileis a directory, it will only be deleted if it is empty.
So I have to check if it is empty before, and if not I have to step through the directory and delete the content before.
How is that possible when I get the mentioned error above, saying that
g_file_measure_disk_usage() cannot be used for remote connections?