Advertisement
Guest User

drive

a guest
Feb 6th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.54 KB | None | 0 0
  1. local tArgs = { ... }
  2.  
  3. -- Get where a directory is mounted
  4. local sPath = shell.dir()
  5. if tArgs[1] ~= nil then
  6.     sPath = shell.resolve( tArgs[1] )
  7. end
  8.  
  9. if fs.exists( sPath ) then
  10.     write( fs.getDrive( sPath ) .. " (" )
  11.     local nSpace = fs.getFreeSpace( sPath )
  12.     if nSpace >= 1000 * 1000 then
  13.         print( (math.floor( nSpace / (100 * 1000) ) / 10) .. "MB remaining)" )
  14.     elseif nSpace >= 1000 then
  15.         print( (math.floor( nSpace / 100 ) / 10) .. "KB remaining)" )
  16.     else
  17.         print( nSpace .. "B remaining)" )
  18.     end
  19. else
  20.     print( "No such path" )
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement