removefile or removedirectory

This is a discussion on removefile or removedirectory within the Windows Programming forums, part of the Platform Specific Boards category; Hi folks; lets say i have a file called "junkmail" that i want to remove and its located like this; ...

  1. #1
    Registered User SAMSAM's Avatar
    Join Date
    Nov 2001
    Posts
    218

    removefile or removedirectory

    Hi folks;

    lets say i have a file called "junkmail" that i want to remove and its located like this;

    C:\program files\junkmail

    would it remove "junkmail" by using removedirectory function or
    my worst nightmare "C:\program files\junkmail" ?

    or should i be using removefile function in this case and do i need to know the files reg key id in advance?

    ?did i make sense, I hope!

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    If you want to delete a file, why are you looking at RemoveDirectory()? RemoveDirectory() does that, it will delete the target directory, (the directory must be empty, i.e. you delete the files in the directory first, then the directory itself).

    To delete a single file use DeleteFile().
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    http://msdn.microsoft.com/library/de..._._wunlink.asp

    use _unlink(), or as adrian has said, DeleteFile()

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21