Is there a way to determine the free space on a drive by using a text file ?
I have a path to a folder which is stored in a text file:
D:\Projects\Videos\current\
I want the program to take the drive letter from the text file and then show the space on the console.
Currently my code is as follows which only shows the free space on my root drive C.
I copied the code straight from the MS page and this obviously does not work as the code is picking my C Drive's space.
I copied the code straight from the MS page and this obviously does not work as the code is picking my C Drive's space.
14 Replies
Path.GetPathRoot()
compare that to the Name
property of the drive infoUnknown User•3y ago
Message Not Public
Sign In & Join Server To View
yes. I am having issue there too.
ok a bit confused.
I added the pathRoot to see the DrivePath string. I do not understand the comparing with the Name property part tho.
string pathRoot;
pathRoot = Path.GetPathRoot(DrivePath);
Does it specifically have to be done via a text file and a certain drive? Any reason you aren’t just getting the capacity of all available drives?
Yes I want it to be done specifically by text files.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
gross..
?
can you tell me what your code is doing ?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
got an exception
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
that works
thank you so much
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I was trying to figure out how exactly this worked.
I still consider myself new to C# 😅