PDA

View Full Version : removing files



LAlexander
10-10-2003, 02:24 AM
during my setup i have to copy some files to the hard disk. then i launch an executable and after that i want to delete the files that i copy to the HD. i used the deletedir fct. but some of the files have the read only attribute. how is it possible to delete them? i think it must be easly, because when i uninstall my application, the files will also be removed automaticlly.

thanks

alex42
10-10-2003, 05:04 AM
you can use SetFileInfo() to remove the readonly flag and then delete them.

LAlexander
10-10-2003, 05:13 AM
i know that i can set the file attribute, but my problem is that i have a folder with a lot of subfolders and files. and so its really a hard work round to set the file attributes of all files.
any other suggestion?? is it possible to call the removeallfeature fct. (or will the entry in the add/remove panel also deleted)??

alex42
10-10-2003, 05:54 AM
you can also use it to set the attributes for a folder...but I dunno if this will only affect the folder or all files/subfolders in it, you'll have to try out.
Don't know of any other way, why are you using read-only flags anyway?

LAlexander
10-10-2003, 07:20 AM
it just take affect on the folder you spezify, not on the subfolders.....

dbriggs
10-10-2003, 09:52 AM
Files copied from an Internet URL turn up with ASHRO attributes.

I wrote a group file copy wrapper function that takes a comma-delimited list of file names and copies them from SRCDIR to TARGETDIR. It checks whether SRCDIR is a URL and uses CopyFile, or XCopyFile if it is not. The file's modification date and time seems to be preserved, but I use SetFileInfo to clear the attributes on any files that were copied from the Internet.

I made the wrapper function return the list of files that it copied (e.g. into SUPPORTDIR or DISK1TARGET) in another string, so that I could tidy them up in my OnEnd handler. Provided I keep track of which files went where, and wait a few seconds after deleting the last file, this seems to be working nicely.

Hope that helps,

David

Nikolaj
10-27-2003, 09:53 AM
How about adding the files to the Support Files/BillBoards instead of as ordinary files?????

Then the files will be removed automatically when the Installation is over!

You can use the SUPPORT_FILES variable to access the files in you install script!

praveendanam
03-02-2007, 02:00 AM
hai,

DeleteDir() with flag ALLCONTENTS


-praveen