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
55 Replies
according to https://learn.microsoft.com/en-us/dotnet/api/system.io.file.copy?view=net-8.0
destination needs to include the filename
"boom.wav" is the filename i want to move
that's great but you're not including it
you're combining 2 directories and not adding the filename at the end
how would i include it because i thought i was already doing that
so in your code what line is combining the directories
353
thats what combineds the paths right?
ok, and what happens if u add 342 to it
that should be the file it copyies to the destinationwavfilepath
i really dont get how its not doing that
add line 342 to line 353
what it would look like?
because right now it does not have the file
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
yes[
so i should combine to destination?
yes that is what it says in there
so with line 355 i can just get rid of that right?
what you mean?
when i run the code the same error comes up but highlights line 355
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
no the bbom.wav is not in that folder
what is the value of both in line 355
sourcewavfile = the name of the wave file i want to move and destination is the file i want to move that file to
print it out like this
make sure u have the right path on both
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
then u have not updated your code
can u show me what your code looks like after the changes I asked u to do
:catfacepalm:
hahahahahahha
i beg
help me
its 5am for me
I asked u, add the file name to line 353 u made a new variable
all u had to do is add
how do i add it
not create any new line
is just another comma
same way u added those
what is your language
c#
no the language u speak
your mother language
english
ok then u should be able to understand what is in red right
so you need to add the file name
like this?
ive added the file name there
that is all u had to do
nothing else
...
what is the other bit i add to the file.copy though
what u had before
this
this was the ONLY thing u had to change
nothing else
im sorry
but thankyou for putting up with me
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
If you have no further questions, please use /close to mark the forum thread as answered