Java tutorial
//package com.java2s; import java.io.File; import java.util.HashMap; import java.util.Map; public class Main { private static Map<Long, String> getFilePathAndModyTime(File file) { Map<Long, String> map = new HashMap<Long, String>(); if (file.isFile()) { map.put(file.lastModified(), file.getAbsolutePath()); } else if (file.isDirectory()) { for (File f : file.listFiles()) { map.putAll(getFilePathAndModyTime(f)); } } return map; } }