Skip to content

I want to code C # to copy an image from folder to another

lamasat lamasat

Asked Jan 6, 2014, 6:19 PM EST4 answers
Share
LinkedInX
Hello
I want to code C Sharp to copy an image from the first folder to the second volume, and if the image already exists in the second volume is replaced
 


I tried to use the function File.Copy () with the Delete () function  , but shows a error in the program when the deletions because the image will be displayed in the pictuerBox refuses to delete the image and replace it

4 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Pruthviraj Mohite
    0
    Copy Image File
    var file = await ApplicationData.Current.LocalFolder.GetFileAsync("myFile.png");
    var folder = await ApplicationData.Current.LocalFolder.GetFolderAsync("myFolder");
    await file.CopyAsync(folder);

    Move Image File
    var file = await ApplicationData.Current.LocalFolder.GetFileAsync("myFile.png");
    var folder = await ApplicationData.Current.LocalFolder.GetFolderAsync("myFolder");
    await file.MoveAsync(folder);


    In the Move Code try for delete() for existing image
    Delete Image File
    var file = await ApplicationData.Current.LocalFolder.GetFileAsync("myFile.png");
    await file.DeleteAsync(StorageDeleteOption.PermanentDelete);



    Try.. If not worked let me know.. I will Help You...
    0
  • 0
    What do you mean by (await )and (ApplicationData)
    0
  • 0
    It is an error to appear in the program
    0
  • Pruthviraj Mohite
    0
    You have to create new method using await and async.. then you can run the code...
    0