public static FileInfo totalFileInfo(File directory) {
		
		FileInfo info = new FileInfo();
		
		int totalFiles = 0;
		long totalFileSize = 0;
		if (!directory.exists()) {
			throw new FileNotExistException("ļ!");
		}
		if (directory.isFile()) {
			info.setTotalFiles(1);
			info.setTotalFileSize(directory.length());
			return info;
		}

		LinkedList<File> stack = new LinkedList<File>();
		stack.push(directory);
		File[] files;
		while (!stack.isEmpty()) {
			files = stack.pop().listFiles();
			for (File file : files) {
				if (file.isDirectory()) {
					stack.push(file);
				} else {
					totalFiles++;
					totalFileSize += file.length();
				}
			}
		}
		
		info.setTotalFiles(totalFiles);
		info.setTotalFileSize(totalFileSize);
		return info;
	}