Created
December 5, 2018 04:28
-
-
Save Allan-Gong/2280eba13a72b3559725608b54b27876 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private def logTempDiskSpace() = { | |
val tempDirectory = new File(System.getProperty("java.io.tmpdir")) | |
val tempDirectoryPath = tempDirectory.getCanonicalPath | |
val tempDirectorySize = FileUtils.byteCountToDisplaySize(FileUtils.sizeOfDirectory(tempDirectory)) | |
logger.debug(s"Temp directory [$tempDirectoryPath] with size $tempDirectorySize") | |
tempDirectory.listFiles().toList.foreach(file => { | |
if (file.isDirectory) { | |
val directorySize = FileUtils.byteCountToDisplaySize(FileUtils.sizeOfDirectory(file)) | |
logger.debug(s"${file.getName} - $directorySize") | |
} else { | |
val fileSize = FileUtils.byteCountToDisplaySize(file.length()) | |
logger.debug(s"${file.getName} - $fileSize") | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment