how can Possible delete File,Files,Directory from FTP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • r2du-soft
    Senior Member
    • Nov 2013
    • 343

    how can Possible delete File,Files,Directory from FTP

    hi
    i check many FTP plugin
    but not found in that's delete a file or files format (*.txt) and directory
    how can Possible delete File,Files,Directory from FTP?
  • r2du-soft
    Senior Member
    • Nov 2013
    • 343

    #2
    can remove directory from batch file
    but do can do it with nsis?

    BatchFile Remove folder AAA From Host
    HTML Code:
    @echo off
    echo FTPUSERNAME> DeleteDirectory.txt
    echo FTPPASSWORD>> DeleteDirectory.txt
    echo CD AAA>>DeleteDirectory.txt
    echo prompt>>DeleteDirectory.txt
    echo mdelete *>>DeleteDirectory.txt
    echo cd ..>>DeleteDirectory.txt
    echo RMdir AAA>>DeleteDirectory.txt
    echo disconnect>>DeleteDirectory.txt
    echo quit>>DeleteDirectory.txt
    ftp -s:DeleteDirectory.txt FTPADDRESS
    del DeleteDirectory.txt

    OR


    HTML Code:
    @echo off 
    echo open FTPADDRESS> DeleteDirectory2.txt
    echo FTPUSERNAME>> DeleteDirectory2.txt
    echo FTPPASSWORD>> DeleteDirectory2.txt
    echo CD AAA>>DeleteDirectory2.txt
    echo prompt>>DeleteDirectory2.txt
    echo mdelete *>>DeleteDirectory2.txt
    echo cd ..>>DeleteDirectory2.txt
    echo RMDIR AAA>>DeleteDirectory2.txt
    echo disconnect>>DeleteDirectory2.txt
    echo quit>>DeleteDirectory2.txt
    ftp -s:DeleteDirectory2.txt
    del DeleteDirectory2.txt










    i need a way for delete folder [Directory] with nsis
    There is a plugin to do this?

    Comment

    • r2du-soft
      Senior Member
      • Nov 2013
      • 343

      #3
      I still did not find a method in nsis
      except call to CMD!
      1-is not possible upgrade inetc:: Plugin for Create Directory and Delete Directory in FTP?

      2-Also is possible About inetc:: errors explain?
      When do they happen I encountered some of them But I do not know what time Other items are displayed!



      HTML Code:
      TEXT("OK")
      TEXT("Connecting")
      TEXT("Downloading")
      TEXT("Cancelled")
      TEXT("Connecting"), //TEXT("Opening URL"))
      TEXT("Reconnect Pause")
      TEXT("Terminated")
      TEXT("Dialog Error")
      TEXT("Open Internet Error")
      TEXT("Open URL Error")
      TEXT("Transfer Error")
      TEXT("File Open Error")
      TEXT("File Write Error")
      TEXT("File Read Error")
      TEXT("Reget Error")
      TEXT("Connection Error")
      TEXT("OpenRequest Error")
      TEXT("SendRequest Error")
      TEXT("URL Parts Error")
      TEXT("File Not Found (404)")
      TEXT("CreateThread Error")
      TEXT("Proxy Error (407)"),
      TEXT("Access Forbidden (403)")
      TEXT("Not Allowed (405)")
      TEXT("Request Error")
      TEXT("Server Error")
      TEXT("Unauthorized (401)")
      TEXT("FtpCreateDir failed (550)")
      TEXT("Error FTP path (550)")
      TEXT("Not Modified"),
      TEXT("Redirection")

      Comment

      • systracer
        Junior Member
        • Apr 2014
        • 16

        #4
        Integrated in OS ftp.exe don't works with passive mode, so is not good idea.

        Comment

        • r2du-soft
          Senior Member
          • Nov 2013
          • 343

          #5
          Yes,Ftp.exe haven't good access to server for complicated works
          I have problem in ftp.exe for remove a directory with subdirectorys
          For example i have a directory with name 'Root' and in that is many folders without file
          I want to delete directory 'Root' with all subdirectorys
          How can do it with nsis or command line?

          Comment

          • Yathosho
            Forum King
            • Jan 2002
            • 3376

            #6
            A couple of years ago I have used cURL with nsExec to do some advanced FTP stuff
            NSIS IDE for Atom | NSIS for Visual Studio Code | NSIS for Sublime Text | NSIS.docset

            Comment

            • r2du-soft
              Senior Member
              • Nov 2013
              • 343

              #7
              I still can not solve the problem of deleting folders with files and subfolders
              ftp.exe At times I do not know it is not working!!!!
              cURL too is an external application
              i need to a DLL to do delete directory with files and sub folders

              Comment

              • Anders
                Moderator
                • Jun 2002
                • 5630

                #8
                Originally Posted by r2du-soft View Post
                I still can not solve the problem of deleting folders with files and subfolders
                ...
                i need to a DLL to do delete directory with files and sub folders
                At this point I think you pretty much have to write it yourself or pay someone to write it for you.
                IntOp $PostCount $PostCount + 1

                Comment

                • r2du-soft
                  Senior Member
                  • Nov 2013
                  • 343

                  #9
                  thanks Anders
                  i found a dll:

                  Download link:



                  Sample of code C#
                  HTML Code:
                  using (Ftp client = new Ftp())
                  {
                      client.Connect("ftp.example.org");
                      client.Login("user", "password");
                      client.CreateFolder("reports");
                      client.Rename("reports", "reports 2010");
                      client.DeleteFolder("reports 2010");
                      client.Close();
                  }

                  now i want know is possible use from dll in nsis?

                  i try this parameters but not work:
                  HTML Code:
                  Section
                  
                  InitPluginsDir
                  SetOutPath "$pluginsdir"
                  File "DLL\Ftp.dll"
                  
                  System::Call "Ftp::Connect('$FTP_Root_Address')"
                  System::Call "Ftp::Login('$FTP_Root_UserName', '$FTP_Root_PassWord')"
                  System::Call "Ftp::CreateFolder('reports')"
                  
                  SectionEnd

                  Comment

                  • Anders
                    Moderator
                    • Jun 2002
                    • 5630

                    #10
                    It it is C# then you must use https://nsis.sourceforge.io/Call_.NE...ethods_plug-in
                    IntOp $PostCount $PostCount + 1

                    Comment

                    • r2du-soft
                      Senior Member
                      • Nov 2013
                      • 343

                      #11
                      i create a dll with C# for delete folder with files and sub folders in FTP
                      but when i want call to that with NSIS i see the message:




                      this is my NSIS Code:

                      HTML Code:
                      XPStyle on
                      
                      Var Ftp_Address
                      Var Ftp_Username
                      Var Ftp_Password
                      Var Ftp_FolderName
                      
                      Section
                      
                      StrCpy $Ftp_Address "FTP.ADDRESS.COM" #	$Ftp_Address
                      StrCpy $Ftp_Username "USERNAME" #		$Ftp_Username
                      StrCpy $Ftp_Password "PASSWORD" #	$Ftp_Password
                      StrCpy $Ftp_FolderName "FOLDER NAME_YOU_WANT_DELETE_THAT" #	$Ftp_FolderName
                      
                        InitPluginsDir
                        SetOutPath $PLUGINSDIR
                        File "DLL\*.*"
                      
                      CLR::Call /NOUNLOAD "FTPCityToolkit.dll" "FTPCityToolkit.DeleteFolderRecursively" "DeleteFtpFolder" 4 "$Ftp_Address" "$Ftp_Username" "$Ftp_Password" "$Ftp_FolderName"
                      Pop $0
                      CLR::Destroy
                      
                      SectionEnd

                      Also This is the FTPCityToolkit.dll SourceCode C#:
                      HTML Code:
                      using Limilabs.FTP.Client;
                      
                      
                      namespace FTPCityToolkit
                      {
                          public class DeleteFolderRecursively
                          {
                               public void DeleteFtpFolder(string FTPServerName, string FTPUsername, string FTPPassWord, string FTPRootFolderName)
                               {
                                  using (Ftp client = new Ftp())
                                  {
                                     client.Connect(FTPServerName);
                                     client.Login(FTPUsername, FTPPassWord);
                                     client.DeleteFolderRecursively(FTPRootFolderName);
                                     client.Close();
                                  }
                               }
                          }
                      }

                      Also i attach the DLLs and DLL C# Project
                      what is my Problem?
                      i need help to solve this
                      Attached Files

                      Comment

                      • Anders
                        Moderator
                        • Jun 2002
                        • 5630

                        #12
                        I would recommend that you create a simple C# app and test this .DLL. If that works then you probably have to run your installer in the Visual Studio debugger.
                        IntOp $PostCount $PostCount + 1

                        Comment

                        • r2du-soft
                          Senior Member
                          • Nov 2013
                          • 343

                          #13
                          Originally Posted by Anders View Post
                          I would recommend that you create a simple C# app and test this .DLL. If that works then you probably have to run your installer in the Visual Studio debugger.
                          i,m tested this DLL in C#,but i dont see any problem and can delete folder with subfolder and files...
                          I think the problem is due to the use of another DLL in my DLL in the program...
                          Anyhow i'm building a DLL to do this And will be ready soon

                          Comment

                          Working...
                          X