Results 1 to 8 of 8

Thread: Delete file problem

  1. #1

    Thread Starter
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Delete file problem

    I want to delete the file in one particular directory. I get error message while any file from that directory is opened.Is it posible to delete that file even it is open.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Delete file problem

    Quote Originally Posted by danasegarane
    I want to delete the file in one particular directory. I get error message while any file from that directory is opened.Is it posible to delete that file even it is open.
    The file needs to be closed before you can delete it.

    What directory are you trying to delete it from and what is the error message that you receive?

  3. #3

    Thread Starter
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Delete file problem

    I have manually created a directory like c:\files.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Delete file problem

    Quote Originally Posted by danasegarane
    I have manually created a directory like c:\files.
    Ok. What is the error?

    If you manually created the directory, then after it has been created it is empty. How does it get files in it?

  5. #5

    Thread Starter
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Delete file problem

    In the command click event I am copying(file system object) a file from path c:\ to c:\files. During the process when I use the kill command to delete all the files in the folder. While doing so if any files accidently opened from the directory it produces a error message command failed in the copy method

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Delete file problem

    You can't delete a folder that has open files in it. Close the files first.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Delete file problem

    Quote Originally Posted by danasegarane
    In the command click event I am copying(file system object) a file from path c:\ to c:\files. During the process when I use the kill command to delete all the files in the folder. While doing so if any files accidently opened from the directory it produces a error message command failed in the copy method
    If you are trying to delete the files from the source folder once they have been copyed to the target folder (thus, performing a "move") then the best way would be to first do the complete copy. When the copy is done, your program will no longer have a connection to the file, so now you can go back and delete them.

  8. #8
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: Delete file problem

    Post the code you have we will help you to solve the problem.
    CS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width