Skip to content

mkyong.com

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

Tag: file size

j
java July 29, 2020 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 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 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

Mkyong.com has provided Java and Spring tutorials, guides, and code snippets since 2008. All published articles are simple, easy to understand, and well-tested in our development environment.

Mkyong.com licenses all source code on this website under the MIT License.

About
  • About Us
  • Code License
  • Privacy Policy
  • Terms Of Use
  • Contact Us
Tools
  • Spring Framework
  • Quarkus Framework
  • Micronaut Framework
  • Oracle Java JDK
  • Eclipse Temurin JDK
  • OpenJDK JDK
  • Hibernate ORM
  • Maven Build Tool
  • Gradle Build Tool
  • Tomcat Application Server
  • Docker
Links
  • Maven Central
  • Docker Hub
  • Spring Guides
  • Quarkus Guides
  • Micronaut Guides
  • Martin Fowler
  • AskPython

© 2026 mkyong.com — Powered by WordPress

RSS