Java File Size Get getFileSize(String path)

Here you can find the source of getFileSize(String path)

Description

get File Size

License

Apache License

Parameter

Parameter Description

Return

long

Declaration

public static long getFileSize(String path) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;

public class Main {

    public static long getFileSize(String path) {
        File file = new File(path);
        if (file.isFile() && file.exists()) {
            return file.length();
        }/*from   ww  w  . j  a v a  2  s . co m*/
        return 0;
    }
}

Related

  1. getFileSize(String filePath)
  2. getFileSize(String filePath)
  3. getFileSize(String fileSize)
  4. getFileSize(String fn)
  5. getFileSize(String loc)
  6. getFileSize(String path)
  7. getFilesize(String path)
  8. getFileSize2(String filename)
  9. getFileSizeAggregate(String[] files)