Hi zwon,
Yes i have rights to delete the directory manually i checked and its working fine. Please fidn code below.

{ my $ftp_remove = Net::FTP->new($ftpremove_host, Debug => 1); $ftp_remove->login($ftpremove_user, $ftpremove_pass); $ftp_remove->cwd($ftpremove_rootdir) or die "Can't change directory + ($ftpremove_rootdir):" . $ftp_remove->message; my $pwd_source = $ftp_remove->pwd; #print "$pwd_source\n"; my @ftp_details = $ftp_remove->ls($pwd_source); foreach my $file (@ftp_details) { if ($ftp_remove->isdir($file) eq "1") { $ftp_remove->rmdir($file,1) or die "Can't remove directory ($f +ile):" . $ftp_remove->message; print $ftp_remove->pwd." Removed folder $file\n"; } else { $ftp_remove->delete($file); #print "Removed $file\n"; } } $ftp_remove->quit(); }

I need to remove the previous date folders but some files are there.

drwxrwxrwx 6 ftpuser test 204 Jul 6 02:23 063009 drwxrwxrwx 2 ftpuser test 68 Jul 6 02:23 070109 drwxrwxrwx 7 ftpuser test 238 Jul 6 06:33 070509 drwxrwxrwx 6 ftpuser test 204 Jul 6 02:45 070609

In reply to Re^4: ftp rmdir with all files by Selvakumar
in thread ftp rmdir with all files by Selvakumar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.