get file length

/**
	 * Get file length
	 * @return
	 */
	public static long getFileSize(String filePath){
		String path=filePath;
		File file = new File(path);
		long size=0;
		if(file.isFile() && file.exists()){//Determine whether the file exists
			size=file.length();
		}else{
	        System.out.println("The file does not exist");
	    }
		return size;
	}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326171115&siteId=291194637
Recommended