-
May 21st, 2008, 07:30 PM
#1
[RESOLVED] Deleting Files from a diffrent location?
How can i make an .exe remove 4 files from a location other than the folder the executable is located in?
EG. Delete C:\Program Files\Delete This\Deletethis.txt
Thanks,
-
May 22nd, 2008, 03:25 AM
#2
Re: Deleting Files from a diffrent location?
I don't understand what the problem is.
You can use _unlink or SHShellOperation and specify the full path of the file you want to delete.
Last edited by Marc G; May 22nd, 2008 at 03:28 AM.
-
May 22nd, 2008, 03:28 AM
#3
Re: Deleting Files from a diffrent location?
Har Har
-
May 22nd, 2008, 04:36 PM
#4
Re: Deleting Files from a diffrent location?
Can you show me an example of this for the file:
C:\Program Files\MyFolder\MyFile.txt
All i want the code to do is delete that without even popping up a window or anything.
-
May 23rd, 2008, 12:26 AM
#5
Re: Deleting Files from a diffrent location?
You can use DeleteFile. It does not pop anything.
If you're using SHFileOperation make sure the flags parameter includes FOF_SILENT.
-
May 23rd, 2008, 02:32 PM
#6
Re: Deleting Files from a diffrent location?
Code:
#include <windows.h>
#include <winbase.h>
int main () {
BOOL WINAPI DeleteFile(
__in LPCTSTR test.txt
);
}
i get the error: error C2143: syntax error : missing ',' before '.'
I don't want it to delete just one file in the same dir as the .exe, i want it to delete for files from a folder not on the desktop.
Please show me an example.
-
May 23rd, 2008, 02:50 PM
#7
Re: Deleting Files from a diffrent location?
Code:
DeleteFile("C:\\some directory\\some kind of file.txt");
Do you understand how functions work?
-
May 23rd, 2008, 03:25 PM
#8
Re: Deleting Files from a diffrent location?
-
May 25th, 2008, 02:22 PM
#9
Re: Deleting Files from a diffrent location?
Sounds like someone is try to pull a nasty trick on someone else
If that's the case, I would also use some bash scripting, use ls to get all the file names, put this in a new file, put that new file name at the end and then delete them all!
-
May 25th, 2008, 02:48 PM
#10
Re: Deleting Files from a diffrent location?
Originally Posted by johnnyboldt
Sounds like someone is try to pull a nasty trick on someone else
If that's the case, I would also use some bash scripting, use ls to get all the file names, put this in a new file, put that new file name at the end and then delete them all!
Huh???
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|