Announcement

Collapse
No announcement yet.

Removing multiple folders in a directory

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Removing multiple folders in a directory

    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.

  • #2
    Re: Removing multiple folders in a directory

    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

    Comment


    • #3
      Re: Removing multiple folders in a directory

      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.
      Regards,

      -Ron

      Music | Video | Pictures

      Comment


      • #4
        Re: Removing multiple folders in a directory

        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

        Comment


        • #5
          Re: Removing multiple folders in a directory

          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.
          Regards,

          -Ron

          Music | Video | Pictures

          Comment


          • #6
            Re: Removing multiple folders in a directory

            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.
            Regards,

            -Ron

            Music | Video | Pictures

            Comment


            • #7
              Re: Removing multiple folders in a directory

              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
              programming is very easy, just put the characters in the right order....

              Comment


              • #8
                Re: Removing multiple folders in a directory

                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.
                Regards,

                -Ron

                Music | Video | Pictures

                Comment


                • #9
                  Re: Removing multiple folders in a directory


                  Does APMS have a bonofide uninstall feature?
                  AutoPlay doesn't, but Setup Factory certainly does.
                  --[[ Indigo Rose Software Developer ]]

                  Comment

                  Working...
                  X