2

I have a question. In my c# application I need to get the free space of a directory. According to my research, GetdiskfreespaceEx is proper and it works for me in my windows xp. Now I'm wondering if it works the same in a linux system. Since I wrote my c# program according to a python one, and for this function the developer of the python one made 2 cases: the windows os or else. For the windows case "ctypes.windll.kernel32.GetDiskFreeSpaceExW" is used while in else case "os.statvfs(folder)" is used.

I did some more research but haven't found anything saying if GetdiskfreespaceEx could be used for linux. Anyone could tell me that? If no, any ways to get free disk space for linux in c#? Thanks in advance!

jiangraf
  • 31
  • 5
  • Mono I assume, see this: http://stackoverflow.com/questions/2168191/functions-for-system-status-c-sharp – tolanj Sep 26 '14 at 09:20
  • @tolanj thx for the reply. But I'm not quite clear: you are suggesting me to install a mono or just using system.IO.DriveInfo class? I don't know if DriveInfo works also for linux, I neither have any idea that how could mono help me – jiangraf Sep 26 '14 at 09:57
  • If your not planning to run your c# app on Linux with Mono how are you proposing to run it on Linux? Or are you talking about getting the freespace of a 'network-disk' hosted on a Linux machine _from_ your c# app running on windows? – tolanj Sep 26 '14 at 10:15

1 Answers1

0

For Linux you will find Statvfs in Mono.Unix.Native, in the Mono.Posix assembly.

maki
  • 431
  • 3
  • 8