Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.File;

import java.util.List;

public class Main {
    private static void readGpxDirectory(File dir, final List<String> list, String parent) {
        if (dir != null && dir.canRead()) {
            File[] files = dir.listFiles();
            if (files != null) {
                for (File f : files) {
                    if (f.getName().toLowerCase().endsWith(".gpx")) { //$NON-NLS-1$
                        list.add(parent + f.getName());
                    } else if (f.isDirectory()) {
                        readGpxDirectory(f, list, parent + f.getName() + "/");
                    }
                }
            }
        }
    }
}