Welcome to the Xceed Community | Help
Community Search  

Trouble with FtpFile.Delete() method

Sort Posts: Previous Next
  •  12-02-2008, 7:08 AM Post no. 17299

    Trouble with FtpFile.Delete() method

    For example, we have ftp folder with 2 existing files. I try to read them from cycle and delete then. 
     
    FtpConnection connection = new FtpConnection("10.1.0.213", 21, @"armentel_main\tech_slt_maf5_exp", "passwd");
    connection.TestConnection();

    FtpFolder folder = new FtpFolder(connection, ""); //just for stub
    folder.GetFiles(true, new NameFilter("*"));

    FtpFile file = new FtpFile(connection, @"\TIAAMRSARM0101312");
    if (file.Exists)
    {
    DateTime dt = file.LastWriteDateTime;
    file.Delete();//OK success, everything is right!!!
    }
    file = new FtpFile(connection, @"\TIAAMRSARM0101350");
    if (file.Exists) //freeze for a long time in this line and then continue in right way (but freezing about 2 minutes !!!)
    {
    DateTime dt = file.LastWriteDateTime;
    file.Delete();
    }
     
    What is the reasong of freezeing after Delete() method call?
     
    XceedFTP ver 3.2.6279.0 
  •  12-02-2008, 4:20 PM Post no. 17312 in reply to 17299

    Re: Trouble with FtpFile.Delete() method

    Can you set the TraceWriter property so we can get a log of the communication with the server?

    FtpConnection.TraceWriter = new StreamWriter( @"D:\ftp.log", true );

     

    You are also using an older version. You can try upgrade to a more recent version to see if this resolves the issue.  Note that if you are in .NET 1.1, you need to need to choose choose package version 2.2.6565.0, download and install it.  Once this is done, download and install the latest Service Pack for .NET 1.1 components, and follow the custom steps specified in the Readme file.

    Here is the link to the package :

    http://xceed.com/Xredirect.aspx?url=http://download4.xceedsoft.com/Packages/2.2.6565.0/XceedComponents.exe


    Here is the link to the service pack :

    http://xceed.com/Xredirect.aspx?url=http://download4.xceedsoft.com/Packages/ServicePacksNET11/Xceed.Components.SP.NET1.1.8115.exe

    If you want to upgrade to .NET 2.0 components, simply download the latest package, and install it.  Note that this will remove all .NET 1.1 components.  If you want both on your system, you need to install the .NET 1.1 service pack.

    http://xceed.com/Xredirect.aspx?url=http://download4.xceedsoft.com/Packages/3.2.8577.11540/XceedComponents.exe

     

     


    André
    Software Developer and Tech Support
    Xceed Software Inc.
  •  12-03-2008, 2:19 AM Post no. 17318 in reply to 17312

    Re: Trouble with FtpFile.Delete() method

    I get compilation error, wnen try to add logging

     

    An object reference is required for the nonstatic field, method, or property 'Xceed.Ftp.FtpConnection.TraceWriter.get' D:\VCitnikov_view\Bell_Sources\Prj.SLOT\Sources\Ftp\FilesLoader\FtpIOProvider.cs

     

     

     

  •  12-03-2008, 4:08 AM Post no. 17320 in reply to 17318

    Re: Trouble with FtpFile.Delete() method

    In this scenario i  read ftp directory, copy 2 files from ftp-server and then try to delete them...

    I got these log

    > CWD /

    < 250 CWD command successful.

    > CWD /

    < 250 CWD command successful.

    > CWD /

    < 250 CWD command successful.

    > CWD /

    < 250 CWD command successful.

    > TYPE A

    < 200 Type set to A.

    > PASV

    < 227 Entering Passive Mode (10,1,0,213,15,121).

    > LIST

    Data connection established with 10.1.0.213:3961 on 03.12.2008 @ 11:44:44

    < 125 Data connection already open; Transfer starting.

    < 226 Transfer complete.

    < 421 Timeout (120 seconds): closing control connection.

    < 421 Terminating connection.

    Disconnected from 10.1.0.213:21 on 03.12.2008 @ 11:47:12

    Connected to 10.1.0.213:21 on 03.12.2008 @ 11:47:26

    < 220 Microsoft FTP Service

    > USER armentel_main\tech_slt_maf5_exp

    < 331 Password required for armentel_main\tech_slt_maf5_exp.

    > PASS *****

    < 230 User armentel_main\tech_slt_maf5_exp logged in.

    > CWD /

    < 250 CWD command successful.

    > TYPE I

    < 200 Type set to I.

    > PASV

    < 227 Entering Passive Mode (10,1,0,213,15,181).

    > RETR TICME20VMPM040551 

    Data connection established with 10.1.0.213:4021 on 03.12.2008 @ 11:47:26

    < 125 Data connection already open; Transfer starting.

    < 226 Transfer complete.

    > CWD /

    < 250 CWD command successful.

    > DELE TICME20VMPM040551

    < 250 DELE command successful.

    > CWD /

    < 250 CWD command successful.

    > TYPE A

    < 200 Type set to A.

    > PASV

    < 227 Entering Passive Mode (10,1,0,213,15,211).

    > LIST

    Data connection established with 10.1.0.213:4051 on 03.12.2008 @ 11:48:34

    < 125 Data connection already open; Transfer starting.

    < 226 Transfer complete.

    > CWD /

    < 250 CWD command successful.

    > TYPE I

    < 200 Type set to I.

    > PASV

    < 227 Entering Passive Mode (10,1,0,213,16,1).

    > RETR TICME20VMPM040552

    Data connection established with 10.1.0.213:4097 on 03.12.2008 @ 11:51:06

    < 125 Data connection already open; Transfer starting.

    < 226 Transfer complete.

    > CWD /

    < 250 CWD command successful.

    > DELE TICME20VMPM040552

    < 250 DELE command successful.

    > CWD /

    < 250 CWD command successful.

    > TYPE A 

     

    call to 2nd file 'copy' method (RETR) takes a lot time (but it is size 500KB)

     This is pared-down piece of code

    AbstractFile[] files = provider.GetFiles(srcFolder, filters);

    for (int i = 0; i < files.Length; i++)

    {

    //Log(Messages.FilesRest, files.Length - i);

    AbstractFile file = filesIdea;

    file.copy();

     

    FtpFile ftpfile = new FtpFile(connection, fullPath);

    Logger.Log("DEBUG_COPY FtpFile created");

    if (ftpfile.Exists) ftpfile .Delete(); 

  •  12-05-2008, 12:15 PM Post no. 17369 in reply to 17320

    Re: Trouble with FtpFile.Delete() method

    Unfortunately, from what you provided, we can't identify the source of the issue.

    The only alternative I can thing of at this point is for you to use the FtpClient class to do the same, and see if this changes something to the issue.


    André
    Software Developer and Tech Support
    Xceed Software Inc.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.