C
C#7mo ago
J.W.H

isa direcotry not a file error

system.io.ioexception: 'the target file 'c:\users\james\onedrive\desktop\hash table login function\hash table login function\bin\debug\net8.0-windows\userfiles\123' is a directory, not a file.' i get this from this
No description
55 Replies
leowest
leowest7mo ago
according to https://learn.microsoft.com/en-us/dotnet/api/system.io.file.copy?view=net-8.0 destination needs to include the filename
leowest
leowest7mo ago
No description
J.W.H
J.W.HOP7mo ago
"boom.wav" is the filename i want to move
leowest
leowest7mo ago
that's great but you're not including it you're combining 2 directories and not adding the filename at the end
J.W.H
J.W.HOP7mo ago
how would i include it because i thought i was already doing that
leowest
leowest7mo ago
so in your code what line is combining the directories
J.W.H
J.W.HOP7mo ago
No description
J.W.H
J.W.HOP7mo ago
353 thats what combineds the paths right?
leowest
leowest7mo ago
ok, and what happens if u add 342 to it
J.W.H
J.W.HOP7mo ago
that should be the file it copyies to the destinationwavfilepath i really dont get how its not doing that
leowest
leowest7mo ago
add line 342 to line 353 what it would look like? because right now it does not have the file
J.W.H
J.W.HOP7mo ago
so how do i make it have the file? beacuse surely adding it to 353 would make it say bin/net8.0/username/boom.wav would that be it
leowest
leowest7mo ago
yes[
J.W.H
J.W.HOP7mo ago
so i should combine to destination?
leowest
leowest7mo ago
yes that is what it says in there
leowest
leowest7mo ago
No description
J.W.H
J.W.HOP7mo ago
so with line 355 i can just get rid of that right?
leowest
leowest7mo ago
what you mean?
J.W.H
J.W.HOP7mo ago
when i run the code the same error comes up but highlights line 355
leowest
leowest7mo ago
do u have a file with the name boom.wav in that folder? go and make sure if u do then u need to add at the end of line 355 true
J.W.H
J.W.HOP7mo ago
no the bbom.wav is not in that folder
leowest
leowest7mo ago
what is the value of both in line 355
J.W.H
J.W.HOP7mo ago
sourcewavfile = the name of the wave file i want to move and destination is the file i want to move that file to
leowest
leowest7mo ago
No description
leowest
leowest7mo ago
print it out like this make sure u have the right path on both
J.W.H
J.W.HOP7mo ago
source = "boom.wav destination = C:\Users\James\OneDrive\Desktop\hash table login function\hash table login function\bin\Debug\net8.0-windows\UserFiles\123 when i run it through code it prints this UserFiles\123\Boom.wav
leowest
leowest7mo ago
then u have not updated your code can u show me what your code looks like after the changes I asked u to do
J.W.H
J.W.HOP7mo ago
No description
leowest
leowest7mo ago
:catfacepalm:
J.W.H
J.W.HOP7mo ago
hahahahahahha i beg help me its 5am for me
leowest
leowest7mo ago
I asked u, add the file name to line 353 u made a new variable all u had to do is add
J.W.H
J.W.HOP7mo ago
how do i add it
leowest
leowest7mo ago
not create any new line
J.W.H
J.W.HOP7mo ago
is just another comma
leowest
leowest7mo ago
No description
leowest
leowest7mo ago
same way u added those
leowest
leowest7mo ago
No description
leowest
leowest7mo ago
what is your language
J.W.H
J.W.HOP7mo ago
c#
leowest
leowest7mo ago
no the language u speak your mother language
J.W.H
J.W.HOP7mo ago
english
leowest
leowest7mo ago
ok then u should be able to understand what is in red right so you need to add the file name
J.W.H
J.W.HOP7mo ago
No description
J.W.H
J.W.HOP7mo ago
like this? ive added the file name there
MODiX
MODiX7mo ago
No description
leowest
leowest7mo ago
that is all u had to do nothing else
J.W.H
J.W.HOP7mo ago
No description
leowest
leowest7mo ago
...
J.W.H
J.W.HOP7mo ago
what is the other bit i add to the file.copy though
leowest
leowest7mo ago
what u had before this
leowest
leowest7mo ago
this was the ONLY thing u had to change
No description
leowest
leowest7mo ago
nothing else
J.W.H
J.W.HOP7mo ago
im sorry but thankyou for putting up with me
leowest
leowest7mo ago
you dont need to be sorry u just need to look carefully at what the code is telling u and read the docs like everytime as ur learning u need to do something if you need to use "c# Path.Combine" u can google it an it should give u the microsoft docs right at the top so u can see what it does https://learn.microsoft.com/en-us/dotnet/api/system.io.path.combine?view=net-8.0#system-io-path-combine(system-string-system-string-system-string) then take a bit of time to read how it works experiment print it to the console $close
MODiX
MODiX7mo ago
If you have no further questions, please use /close to mark the forum thread as answered
Want results from more Discord servers?
Add your server