gfal_testdir.c

This example show how to list the files in a directory ex : use case with SRM plugin : ./gfal_testdir srm://grid05.lal.in2p3.fr:8446/dpm/lal.in2p3.fr/home/dteam/test_r2d2

#include <stdio.h>
#include <stdlib.h>
#include "gfal_api.h"
#include "gfal_posix_internal.h"

int main(int argc, char **argv)
{
        struct dirent *d;
        DIR *dir;

        if (argc != 2) {
                fprintf (stderr, "usage: %s filename\n", argv[0]);
        return 1;
        }

        gfal_set_verbose(10);

        if ((dir = gfal_opendir (argv[1])) == NULL) {
                perror ("gfal_opendir");
                fprintf(stderr, "%s\n", (*gfal_posix_get_last_error())->message);
        return 1;
        }

    
        while ((d = gfal_readdir (dir))) {
                printf ("%s\n", d->d_name);
        }

        if (gfal_closedir (dir) < 0) {
                perror ("gfal_closedir");
        return 1;
        }
    return 0;
}

Generated on 28 Nov 2013 for GFAL2 by  doxygen 1.6.1