in reply to Re^2: df sometimes hangs in Win32 OS
in thread df sometimes hangs in Win32 OS
So, what I think is being said is that the script this is in needs an OS checker so it can load a Win32 specific utility to do the job?
I have a df utility on my windows system -- part of the UnxUtils package though it segfaults on my 64-bit OS -- but generally most windows systems will not have it, and expecting users to find and install one is naive.
Far simpler I think to use something like:
sub freespace { if( $^O eq 'MSWin32' ) { `fsutil volume diskfree .` =~ m[avail free bytes : (\d+)]; return ( $1 // die $! ) / 1024; } elsif( $^O eq ... ) { ... } else { `df -k .` =~ m[...]; return $1 // die $! } } ... my $free = freespace();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: df sometimes hangs in Win32 OS
by Dandello (Monk) on Sep 22, 2012 at 22:44 UTC |