Announcement

Collapse
No announcement yet.

FTP.RemoveDir(sFTPdir); Won't delete Folder if not empty?

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

  • FTP.RemoveDir(sFTPdir); Won't delete Folder if not empty?

    If I use the FTP.RemoveDir(sFTPdir) command it only removes empty folders on the server, but states
    "Request denied by server" if anything is inside the folder.


    Any Ideas how I can delte/remove a folder containing stuff?


    Regards
    R

  • #2
    You need to delete all files and sub folders in it before you can delete the folder itself.

    Ulrich

    Comment


    • #3
      Thanks Ulrich
      How would I do this then? With some sort of loop script?

      Comment


      • #4
        Yes, sort of. You would use a function which enters each sub folder recursively and deletes all files in it, and then deletes the folder itself.

        Ulrich

        Comment


        • #5
          Could you point me in the right direction with some code?
          Regards

          Comment


          • #6
            The sample project shows how to empty a folder - all files and sub folders in it are deleted.

            Note that this may fail in certain circumstances. File names starting with a dot are hidden on the server, and they don't appear in the list returned by FTP.List(). As a result, they are not deleted, unless you perform a command to specifically delete the file(s). If the folder is not empty, it can't be deleted.

            Ulrich
            Attached Files

            Comment


            • #7
              Ulrich, you are the best!
              Regards
              Ron

              Comment


              • #8
                Code does not seem to work. Maybe I am missing something here, but it still wont delete the folder..

                Comment


                • #9
                  Sorry, I missed a thing..

                  thanks

                  Comment

                  Working...
                  X