View Full Version : Removing multiple folders in a directory
msmith
03-29-2003, 10:21 AM
How can I remove multiple folders, within a directory, using the folder.remove command.
I first run file.delete ("C:\FILE\*.*")
then
Folder.remove ("C:\FILE\")
And I get a error Message
Could not remove directory.
The dirctory is not empty.
Corey
03-29-2003, 03:12 PM
Works fine over here, try removing the trailing slash from your folder path in the 'folder remove' function and try checking "delete hidden and system files" on your 'file delete function'...
If you're trying to remove multiple folders perhaps a WHILE loop would work well.
If you wish to remove *all* the folders within a folder that's easy, just delete all the files from the master folder using a FILE DELETE action with the recurse subdirectories option on and then remove the master folder. You can then recreate it if needed using a folder create action...
Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)
rhosk
08-08-2003, 07:02 AM
I too have this problem. I'm trying to delete the files and folders in one swoop, but it's going too fast. If I exit, and come back into the build preview, it will delete the folder/subfolders.
Is there a certain 'pause' I can put between the delete.files and Remove.folder action? Thanks very much.
You can try an Application.Sleep action with a value of say .5 seconds in between these actions. The issue probably has something to do with Windows caching. The remove directory action will not work if there are files in the folder, if you catch this when the files are still being deleted then this could cause this type of functionality. I have never run into this problem personally but I can see how it could happen.
Silly Windows
rhosk
08-08-2003, 11:15 AM
Thanks Adam. I figured out why it won't delete a subfolder in this directory and therefore, won't delete the mother folder in that same process. The structure is such that I have two folders with the same name, one below each other. The one on top is left after using file.delete. For this third party application, it must remain that way. I've tried to delete the duplicate folder with a seperate action, but it won't let me do that as well. Says that a process is using it. This is probably going beyond the AMP software, but does anyone know what's going on here and maybe a way to stop it? If I exit and return, I can hit the same button and the mother and sub-folder (the duped named) will delete no problem?? Any help would be great.
rhosk
08-08-2003, 04:37 PM
Just to add, I have a workaround for this problem, but it involves yet another install program. Would really like to use AMP4 for the whole thing if anyone has an idea of what the problem is. Maybe some action that will halt the file.delete function and move on to removing the folders? Any suggestion would be appreciated, thanks.
I think you all try to remove the files (and folders) of the installed or copied APMS runfiles from the harddisk. It is not possible to delete a file that is currently running.
When the user wants to delete the copied files, my program asks the user to place the CD in the CD-drive, the APMS file will exit and a new program from the CD is deleting the files including the dirs from the harddisk.
So yes, you need another program.
gr. Mario
rhosk
08-09-2003, 05:01 AM
No, these particular files have nothing to do with APMS runtime files. Totally seperate application. It's not removing everything because of the duplicated folder/sub-folder and I can't find anyway around this. (If I rename the folder so that it's not the same name, it deletes fine, so I'm not blaming AMPS at all, just loooking for a solution to the problem)
Does APMS have a bonofide uninstall feature? OR are we stuck with just removing (deleting files). If it had an uninstall log and executable, I'm sure it would wipe these folders clean without a problem.
Lorne
08-11-2003, 09:36 AM
Does APMS have a bonofide uninstall feature?
AutoPlay doesn't, but Setup Factory certainly does.
Powered by vBulletin™ Version 4.0.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.