Here is the code:
use File::glob;
use strict;
use Net::FTP;
use File::Copy;
use File::Path;
use File::Remove;
my $host_disco = "censored";
my $user_disco = "censored";
my $password_disco = "censored";
my $ftp_disco = "";
my $dir = "/";
my $diriq_disco = "/ep005/egate/client/iq";
my @iqfiles_disco = "";
my $file1 = "";
my @iqfolder_arr = "";
my $folder = "";
my $iqfolder = "";
my $folder1 = "";
my $count = 0;
#-------------------------
$ftp_disco = Net::FTP->new($host_disco) or die "Can't open $host_disco
+: $@\n";
$ftp_disco->login($user_disco, $password_disco) or die "Couldn't login
+: @{[ $ftp_disco->message ]}";
$ftp_disco->ascii();
$ftp_disco->cwd($dir) or die "Couldn't cwd to $dir: @{[ $ftp_disco->me
+ssage ]}\n";
$ftp_disco->cwd($diriq_disco) or die "Couldn't cwd to $diriq_disco: @{
+[ $ftp_disco->message ]}\n";
@iqfolder_arr = $ftp_disco->ls;
foreach $folder1 (@iqfolder_arr)
{
$iqfolder_arr[$count] =~ s/ //g;
$iqfolder_arr[$count] =~ s/\n//g;
$count++ }
foreach $folder (@iqfolder_arr)
{
my $dirpath = '/ep005/egate/client/iq/';
$dirpath .= $folder;
print($dirpath);
$ftp_disco->rmdir($dirpath) || die "FTP Message> @{[ $ftp_disco->mess
+age ]}\n";
}
$ftp_disco->close();
$file1 = "";
sleep(2);
print("Disco IQs have been cleared.\n");
#-----------------------------------#
Error Message: /ep005/egate/client/iq/{E9424A48-0086-11D7-AE05-AD16EA76821A}FTP Message> /ep005
/egate/client/iq/{E9424A48-0086-11D7-AE05-AD16EA76821A}: Do not specify an exist
ing file.
Press Enter to continue
Seems like I have the right idea and the correct methods maybe but I am not sure if maybe the folder that I am trying to remove maybe causing the problem because of the "{}" brackets. I tried using an asterick too but to no avail.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|