How to find the amount of free storage (disk space) left on Android? [duplicate]

Example: Getting human readable size like 1 Gb String memory = bytesToHuman(totalMemory()) /************************************************************************************************* Returns size in bytes. If you need calculate external memory, change this: StatFs statFs = new StatFs(Environment.getRootDirectory().getAbsolutePath()); to this: StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getAbsolutePath()); **************************************************************************************************/ public long totalMemory() { StatFs statFs = new StatFs(Environment.getRootDirectory().getAbsolutePath()); long total = (statFs.getBlockCount() * statFs.getBlockSize()); return total; … Read more

How do I retrieve disk information in C#?

For most information, you can use the DriveInfo class. using System; using System.IO; class Info { public static void Main() { DriveInfo[] drives = DriveInfo.GetDrives(); foreach (DriveInfo drive in drives) { //There are more attributes you can use. //Check the MSDN link for a complete example. Console.WriteLine(drive.Name); if (drive.IsReady) Console.WriteLine(drive.TotalSize); } } }

How do I read a disk directly with .Net?

Cool, thank you Mark, I had forgotten that CreateFile opens things too. I was looking at the volume management API and not seeing how to open things. Here is a little class that wraps things up. It might also be possible/correct to just pass the SafeFileHandle into a FileStream. using System; using System.Runtime.InteropServices; using System.IO; … Read more

Manipulate an Archive in memory with PHP (without creating a temporary file on disk)

I had the same problem but finally found a somewhat obscure solution and decided to share it here. I came accross the great zip.lib.php/unzip.lib.php scripts which come with phpmyadmin and are located in the “libraries” directory. Using zip.lib.php worked as a charm for me: require_once(LIBS_DIR . ‘zip.lib.php’); … //create the zip $zip = new zipfile(); … Read more

How much faster is the memory usually than the disk?

I’m surprised: Figure 3 in the middle of this article, The Pathologies of Big Data, says that memory is only about 6 times faster when you’re doing sequential access (350 Mvalues/sec for memory compared with 58 Mvalues/sec for disk); but it’s about 100,000 times faster when you’re doing random access.