Old 30th July 2017, 18:43   #1
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 337
Question 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 is online now   Reply With Quote
Old 30th July 2017, 23:24   #2
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 337
Question

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?
r2du-soft is online now   Reply With Quote
Old 5th August 2017, 00:22   #3
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 337
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")
r2du-soft is online now   Reply With Quote
Old 27th August 2017, 06:05   #4
systracer
Junior Member
 
Join Date: Apr 2014
Posts: 12
Integrated in OS ftp.exe don't works with passive mode, so is not good idea.
systracer is offline   Reply With Quote
Old 22nd September 2017, 15:49   #5
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 337
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 is online now   Reply With Quote
Old 25th September 2017, 16:48   #6
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,363
A couple of years ago I have used cURL with nsExec to do some advanced FTP stuff
Yathosho is offline   Reply With Quote
Old 26th January 2019, 12:25   #7
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 337
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
r2du-soft is online now   Reply With Quote
Old 26th January 2019, 12:58   #8
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,163
Quote:
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
Anders is offline   Reply With Quote
Old 26th January 2019, 16:35   #9
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 337
thanks Anders
i found a dll:

Download link:
https://www.limilabs.com/static/ftp/Ftp.zip


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
r2du-soft is online now   Reply With Quote
Old 26th January 2019, 19:20   #10
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,163
It it is C# then you must use https://nsis.sourceforge.io/Call_.NE...ethods_plug-in

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 25th February 2019, 17:16   #11
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 337
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 Thumbnails
Click image for larger version

Name:	CLR.jpg
Views:	113
Size:	14.1 KB
ID:	54400  
Attached Files
File Type: zip FTPCityToolkit.net 2.0 DLL CODE.zip (541.0 KB, 47 views)
File Type: zip Delete Folders NSIS Code.zip (258.6 KB, 44 views)
r2du-soft is online now   Reply With Quote
Old 26th February 2019, 22:03   #12
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,163
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
Anders is offline   Reply With Quote
Old 26th February 2019, 22:12   #13
r2du-soft
Senior Member
 
r2du-soft's Avatar
 
Join Date: Nov 2013
Location: Iran
Posts: 337
Quote:
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
r2du-soft is online now   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
ftp

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump