Solved

FTP problem

Posted on 2006-10-19
7
798 Views
Last Modified: 2008-02-01
I am trying to delete folder on FTP server with two files inside. The procedure is the following:

  1. Enter the folder;
  2. Delete the frist file (big one);
  3. Delete the second file (small one)
  4. Leave the folder
  5. Delete the folder

I always receive the message that folder is not empty (the big file is still there)! I am using Indy TIdFTP component from Delphi/C++ Builder:

  ChangeDir (FolderName);
  Delete (FileName1);
  Delete (FileName2);
  ChangeDirUp;
  RemoveDir (FolderName);

If I make a longer pause before RemoveDir method everything is OK! I tried to insert a loop before ChangeFolderUp method which checked if folder is empty once a second. After about 25 seconds the file was finaly deleted and everything finished OK!?!

TotalCommander finishes job fast, an there is nothing inside its log different from this I already did (except TC first tried to delete non-empty folder (RMD) and to delete it like it was file (DELE) prior to entering the folder and deleting its files.

Any idea what should I do to make it work fast?
0
Comment
Question by:adlabac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
7 Comments
 

Expert Comment

by:thundt2
ID: 17771065
I'd try not ChangeDiring into that folder, and instead deleting foldername + filename.  In other words, eliminate steps 1 and 4 from your list.  (Perhaps the ftp server is slow to realize you aren't still visiting the folder.)
0
 
LVL 2

Author Comment

by:adlabac
ID: 17772024
Thank you for the answer!

Actually, I did it like you said the first time. Since it did not work, I tried to enter/leave folder just to be sure that I am not inside. Total comander does it the same way - enters, gets list of files, deletes every file, leaves and, finally, it deletes the folder.
0
 

Expert Comment

by:thundt2
ID: 17772074
The next thing I would try is look for a log from the ftp daemon -- see if it has more details on what you are doing vs what Commander is doing.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:adlabac
ID: 17772114
Yes, I thought of that. The problem is that it is some non-standard FTP server in modified Windows version (by Ericsson), and I cannot find any configuration utility to enable logging... I will try to trace it with Ethereal today.
0
 
LVL 2

Author Comment

by:adlabac
ID: 17840439
I finally found the cause of the problem. Unfortunately there was no right solution, just a workaround.

What I discovered is that there is a problem only if I download the file first! If not, the file is deleted instantly! The same is with Total Commander, as well - If I firstly download (large) file it says that it is deleted OK, but it is still in the folder for some time (usually 20-30 seconds). I even tried to disconnect and reconnect after downloading, bit problem remained.

I am, right not, waiting for folder to be empty before deleting it. If nobody has the some idea, this question should be closed.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 18016342
PAQed with points refunded (250)

Computer101
EE Admin
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
in SAS how to create a record for each combination of the two duplicates? 16 126
Help Required 3 132
What does != "" mean in programming 8 181
AvlTree-Node Data type 4 44
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question