-2

I want to copy a zip file from temp folder to a browsed location (say Destinydirectory).

This is my code however it gives me an error:

If System.IO.Directory.Exists(My.Computer.FileSystem.CombinePath(My.Computer.FileSystem.SpecialDirectories.Temp, "IXP001.TMP")) Then
    System.IO.Directory.Delete(My.Computer.FileSystem.CombinePath(My.Computer.FileSystem.SpecialDirectories.Temp, "IXP000.TMP"), True)
    FileCopy = "c:\\Users\\Test\\AppData\\Local\\Temp\\IXP001.TMP\\bin.zip"
Else
    FileCopy = "c:\\Users\\Test\\AppData\\Local\\Temp\\IXP000.TMP\\bin.zip"
End If
File.Copy(FileCopy, Destinydirectory)
Bugs
  • 4,491
  • 9
  • 32
  • 41
t.Chat02
  • 7
  • 4
  • If you could give some details about what you tried we might be able to help you better. Did you see: http://stackoverflow.com/help/mcve – Martin Brown Jan 12 '17 at 10:02
  • IfSystem.IO.Directory.Exists(My.Computer.FileSystem.CombinePath(My.Computer.FileSystem.SpecialDirectories.Temp, "IXP001.TMP")) Then System.IO.Directory.Delete(My.Computer.FileSystem.CombinePath(My.Computer.FileSystem.SpecialDirectories.Temp, "IXP000.TMP"), True) FileCopy = "c:\\Users\\Test\\AppData\\Local\\Temp\\IXP001.TMP\\bin.zip" Else FileCopy = "c:\\Users\\Test\\AppData\\Local\\Temp\\IXP000.TMP\\bin.zip" End IfFile.Copy(FileCopy, Destinydirectory) @Martin Brown – t.Chat02 Jan 12 '17 at 10:08
  • Is it throwing an exception? If so can you let us have the exact wording of the error message please? Also what is Destinydirectory set to? – Martin Brown Jan 12 '17 at 10:16
  • [File.Copy](https://msdn.microsoft.com/en-us/library/c6cfw35a(v=vs.110).aspx) requires a filename on both arguments. What is the value of `Destinydirectory`? – Bugs Jan 12 '17 at 10:39

1 Answers1

0

This is the code:

System.IO.File.Copy(@"c:\temp\file.zip", @"c:\destination\file.zip");

Which kind of exception you receive?

Msdn documentation