Skip to content

mkyong.com

  • Spring Boot
  • Java Virtual Threads
  • Contact
  1. Home /
  2. file size

Tag: file size

j
java July 29, 2020 3 min read by mkyong 1 comment

How to get size of a directory in Java

In Java, we can use Files.size to get the size of a file; for the directory or folder size, we need to count the size of a directory recursively (sum of the Files.size of all files). This example shows a few common ways to get the size of a directory or folder. FileVisitor (Java 7) […]

Read more How to get size of a directory in Java
mac logo
mac August 5, 2012 1 min read by mkyong 3 comments

How to find large file size on Mac OS X

In this tutorial, we show you two ways to find large files on Mac OS X. Built-in search tools Find command 1. Search Tools To open the search tools, do following : Mac OS X Desktop, run Finder. Press Command+F to open “Search Tools” (it also can be located from menu -> File -> Find). […]

Read more How to find large file size on Mac OS X
j
java May 31, 2010 2 min read by mkyong 16 comments

How to get file size in Java

In Java, we can use Files.size(path) to get the size of a file in bytes. // size in bytes long bytes = Files.size(path); 1. Files.size (NIO) This example uses NIO Files.size(path) to print the size of an image file (140 kb). GetFileSize.java package com.mkyong.io.howto; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class GetFileSize […]

Read more How to get file size in Java

Java and Spring tutorials since 2008. Every example is a complete, runnable file, compiled and run on a real machine before it goes out.

About This Site

  • About
  • Editorial Policy
  • Contact
  • Code License
  • Privacy Policy
  • Terms of Use

© 2026 mkyong.com — Powered by WordPress

RSS