Warning: This will not work in all cases!
Just because there is enough space on the root of a drive doesn't mean there is enough space in the current directory. Likewise there might not be the space at the root but there is space in the current directory.
Windows at least is capable of figuring out the space in the current directory as evidenced by multiple programs correctly reporting the free space in the current directory even when it doesn't match the space at the root. I have not investigated how to accomplish this.
(The situation I'm thinking of is volumes mapped into subdirectories.)