Skip to content
⌘ NSIS Forum Archive

how can Possible delete File,Files,Directory from FTP

13 posts

r2du-soft#

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#
can remove directory from batch file
but do can do it with nsis?

BatchFile Remove folder AAA From Host
@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


@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?
r2du-soft#
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!



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")
r2du-soft#
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?
r2du-soft#
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
Anders#
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.
r2du-soft#
thanks Anders
i found a dll:

Download link:



Sample of code C#
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:
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
r2du-soft#
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:

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#:
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
Anders#
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.
r2du-soft#
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 🙂