Skip to content

[Feature]: Display folder size in file screen #406

@florent37

Description

@florent37

What do you want to see in Flocon?

add an option to enable folder size to be computed on mobile (can be expensive work)

public class FolderSize {
    public static long getFolderSize(Path folder) throws IOException {
        try (Stream<Path> walk = Files.walk(folder)) {
            return walk
                    .filter(Files::isRegularFile)
                    .mapToLong(p -> {
                        try {
                            return Files.size(p);
                        } catch (IOException e) {
                            return 0L;
                        }
                    })
                    .sum();
        }
    }

    public static void main(String[] args) throws IOException {
        Path path = Paths.get("/chemin/vers/dossier");
        long size = getFolderSize(path);
        System.out.println("Taille du dossier : " + size + " octets");
    }
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions