rmdir

rmdir

am 24.06.2011 11:43:34 von Irfan Sayed

--0-710060472-1308908614=:88998
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

hi,=0Ai need to delete some directories recursively which are present=
at some shared location i tried file::path perl module but the issue=
with that module is , it is not deleting the root/parent dir it delet=
es the subdirectories and all the files inside that but not removing root d=
ir here is my code:  $path =3D "\\\\build\\" . "f\$" . "\\Store\\b=
uild\\Internal_Builds\\Daily_Builds\\Daily\\zoc\\" . $hash_fin{$key};  =
 print "$path\n";  print "**********\n";   remove_tree($path,=
{verbose =3D> 1,safe =3D> 1,keep_root =3D> 0}); now whaat i expect is =
, module shud delete the dir which is there in $path but it does not=0Aplz =
suggest =0Aregards=0Airfan
--0-710060472-1308908614=:88998--

Re: rmdir

am 24.06.2011 21:05:28 von Chris Charley

"Irfan Sayed" wrote in message
news:1308908614.88998.YahooMailNeo@web125518.mail.ne1.yahoo. com...



hi,
i need to delete some directories recursively which are present at some
shared location

i tried file::path perl module but the issue with that module is , it is not
deleting the root/parent dir

it deletes the subdirectories and all the files inside that but not removing
root dir

here is my code:
$path = "\\\\build\\" . "f\$" .
"\\Store\\build\\Internal_Builds\\Daily_Builds\\Daily\\zoc\\ " .
$hash_fin{$key};

print "$path\n";
print "**********\n";
remove_tree($path,{verbose => 1,safe => 1,keep_root => 0});

now whaat i expect is , module shud delete the dir which is there in $path
but it does not
plz suggest


regards
irfan

Hello irfan,

why are you using 2 leading backslashes at the start of your path?
$path = "\\\\build\\"
Shouldn't there only be 1 backslash?
$path = "\\build\\"


By the way, perl will recognize forward slashes for Windows paths like:
"/build/" . "f\$" . "/Store/build/Internal_Builds/Daily_Builds/Daily/zoc/" .
$hash_fin{$key};

which will save some typing and looks better as well!

Chris


--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: rmdir

am 27.06.2011 12:22:24 von Irfan Sayed

--0-629363277-1309170144=:90202
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

plz suggest . i am stuck ________________________________=0AFrom=
: Irfan Sayed =0ATo: Perl Beginners erl.org>=0ASent: Friday, June 24, 2011 3:13 PM=0ASubject: rmdir =
=0Ahi,=0Ai need to delete some directories recursively which are present at=
some shared location i tried file::path perl module but the issue wi=
th that module is , it is not deleting the root/parent dir it deletes =
the subdirectories and all the files inside that but not removing root dir=
here is my code:  $path =3D "\\\\build\\" . "f\$" . "\\Store\\bui=
ld\\Internal_Builds\\Daily_Builds\\Daily\\zoc\\" . $hash_fin{$key};   =
 print "$path\n";  print "**********\n";   remove_tree($path,{=
verbose =3D> 1,safe =3D> 1,keep_root =3D> 0}); now whaat i expect is ,=
module shud delete the dir which is there in $path but it does not=0Aplz s=
uggest =0Aregards=0Airfan
--0-629363277-1309170144=:90202--

Re: rmdir

am 27.06.2011 13:20:02 von Shlomi Fish

Hi Irfan,

On Fri, 24 Jun 2011 02:43:34 -0700 (PDT)
Irfan Sayed wrote:

>
>
> hi,
> i need to delete some directories recursively which are present at some
> shared location
>
> i tried file::path perl module but the issue with that module is , it is not
> deleting the root/parent dir
>
> it deletes the subdirectories and all the files inside that but not removing
> root dir

1. Maybe try to trigger the 'verbose' or 'error' or whatever flags and see what
it reports.

2. If all else fails, try using perl -d :

http://perl-begin.org/topics/debugging/

Regards,

Shlomi Fish

--
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
Stop Using MSIE - http://www.shlomifish.org/no-ie/

Larry Wall applies a patch manually quicker than GNU patch.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: rmdir

am 27.06.2011 13:59:29 von Irfan Sayed

--0-2139698065-1309175969=:63287
Content-Type: text/plain; charset=us-ascii

i did that but no luck
is there any another way ?

regards
irfan



________________________________
From: Shlomi Fish
To: Irfan Sayed
Cc: Perl Beginners
Sent: Monday, June 27, 2011 5:05 PM
Subject: Re: rmdir




Shlomi Fish (shlomif@shlomifish.org) added themselves to your Guest List | Remove them | Block them
--0-2139698065-1309175969=:63287--

Re: rmdir

am 27.06.2011 14:23:08 von Shlomi Fish

Hi Pangj,

On Mon, 27 Jun 2011 14:07:51 +0100
pangj@laposte.net wrote:

>=20
> Won't system "rm -rf /path/to/dir" just work for you?
>=20

1. This is on Windows, so "rm" may not be available. perldoc -f system in
general is not portable.

2. Better use the list form of system:

system("rm", "-fr", $path);

With the string version, you're risking code injection:

http://shlomif-tech.livejournal.com/35301.html

Regards,

Shlomi Fish

>=20
>=20
> > Message du 27/06/11 13:59
> > De : "Irfan Sayed"=20
> > A : "Shlomi Fish"=20
> > Copie à : "Perl Beginners"=20
> > Objet : Re: rmdir
> >
> > i did that but no luck
> > is there any another way ?
> >=20
> > regards
> > irfan
> >=20
> >=20
> >=20
> > ________________________________
> > From: Shlomi Fish=20
> > To: Irfan Sayed=20
> > Cc: Perl Beginners=20
> > Sent: Monday, June 27, 2011 5:05 PM
> > Subject: Re: rmdir
> >=20
> >=20
> >=20
> >=20
> > Shlomi Fish (shlomif@shlomifish.org) added themselves to your Guest Lis=
t |
> > Remove them | Block them=20
>=20
> Une messagerie gratuite, garantie à vie et des services en plus, =C3=
=A7a vous
> tente ? Je crée ma boîte mail www.laposte.net
>=20



--=20
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
Why I Love Perl - http://shlom.in/joy-of-perl

Chuck Norris writes understandable Perl code.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: rmdir

am 27.06.2011 14:28:48 von Shlomi Fish

Hi Irfan,

On Mon, 27 Jun 2011 04:59:29 -0700 (PDT)
Irfan Sayed wrote:

> i did that but no luck
> is there any another way ?

What did you do? What did you try? What happened? Did you try using the error
flags like I told you or perl -d? What happens when you are using them? Please
copy and paste the output from the program and your attempts to debug them.

Regards,

Shlomi Fish

--
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
My Public Domain Photos - http://www.flickr.com/photos/shlomif/

Only wimps complain about bad code. Real men clean it up.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: rmdir

am 27.06.2011 14:29:44 von Irfan Sayed

--0-1542013144-1309177784=:1835
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

even i tried windows del command =0Abut it prompts for confirmation to dele=
te the files=0Ado u know how to suppress these prompts ? i did not find any=
switch which allows you to suppress pls suggest. regards=0Airfan=
________________________________=0AFrom: Shlomi Fish hlomifish.org>=0ATo: pangj@laposte.net=0ACc: Irfan Sayed ahoo.com>; Perl Beginners =0ASent: Monday, June 27, 201=
1 5:53 PM=0ASubject: Re: rmdir Hi Pangj, On Mon, 27 Jun 2011 14:0=
7:51 +0100=0Apangj@laposte.net wrote: > =0A> Won't system "rm -rf /pat=
h/to/dir" just work for you?=0A> 1. This is on Windows, so "rm" may n=
ot be available. perldoc -f system in=0Ageneral is not portable. 2. Be=
tter use the list form of system: system("rm", "-fr", $path); Wit=
h the string version, you're risking code injection: http://shlomif-te=
ch.livejournal.com/35301.html Regards,   =A0 Shlomi Fish=0A=
=0A> =0A> =0A> > Message du 27/06/11 13:59=0A> > De : "Irfan Sayed" =0A> > =
A : "Shlomi Fish" =0A> > Copie =E0 : "Perl Beginners" =0A> > Objet : Re: rm=
dir=0A> >=0A> > i did that but no luck=0A> > is there any another way ?=0A>=
> =0A> > regards=0A> > irfan=0A> > =0A> > =0A> > =0A> > __________________=
______________=0A> > From: Shlomi Fish =0A> > To: Irfan Sayed =0A> > Cc: Pe=
rl Beginners =0A> > Sent: Monday, June 27, 2011 5:05 PM=0A> > Subject: Re: =
rmdir=0A> > =0A> > =0A> > =0A> > =0A> > Shlomi Fish (shlomif@shlomifish.org=
) added themselves to your Guest List |=0A> > Remove them | Block them =0A>=
=0A> Une messagerie gratuite, garantie =E0 vie et des services en plus, =
=E7a vous=0A> tente ? Je cr=E9e ma bo=EEte mail www.laposte.net=0A> =
-- =0A--------------------------------------------------------- ------=
--=0AShlomi Fish=A0 =A0 =A0 http://www.shlomifish.org/=0AWhy I Love Perl -=
http://shlom.in/joy-of-perl Chuck Norris writes understandable Perl c=
ode. Please reply to list if it's a mailing list post - http://shlom.i=
n/reply .
--0-1542013144-1309177784=:1835--

Re: rmdir

am 27.06.2011 14:39:44 von Shawn H Corey

On 11-06-27 08:29 AM, Irfan Sayed wrote:
> even i tried windows del command
> but it prompts for confirmation to delete the files
> do u know how to suppress these prompts ? i did not find any switch which allows you to suppress
>

It sounds like some of the files or directories have their read-only bit
set.

What is the output of this:

use File::Path;
my $errors = [];
rmtree( $dir, { error => \$errors });
print "$_\n" for @$errors;

BTW, I do believe the correct Windows command is: del /s


--
Just my 0.00000002 million dollars worth,
Shawn

Confusion is the first step of understanding.

Programming is as much about organization and communication
as it is about coding.

The secret to great software: Fail early & often.

Eliminate software piracy: use only FLOSS.

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: rmdir

am 27.06.2011 14:42:21 von Rob Coops

--0015175771dc15039f04a6b0e380
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Mon, Jun 27, 2011 at 3:31 PM, wrote:

> Hi Fish,
>
> In my example (there is no metachar), the two forms of system call are th=
e
> same.
> from perldoc -f system:
>
> If there is only one scalar
> argument, the argument is checked for shell metacharacters, and if there
> are any, the entire argument is passed
> to the system's command shell for parsing (this is "/bin/sh -c" on Unix
> platforms, but varies on other
> platforms). If there are no shell metacharacters in the argument, it is
> split into words and passed directly to
> "execvp", which is more efficient.
>
>
>
>
> > Message du 27/06/11 14:23
> > De : "Shlomi Fish"
> > A : pangj@laposte.net
> > Copie à : "Irfan Sayed" , "Perl Beginners"
> > Objet : Re: rmdir
> >
> > Hi Pangj,
> >
> > On Mon, 27 Jun 2011 14:07:51 +0100
> > pangj@laposte.net wrote:
> >
> > >
> > > Won't system "rm -rf /path/to/dir" just work for you?
> > >
> >
> > 1. This is on Windows, so "rm" may not be available. perldoc -f system =
in
> > general is not portable.
> >
> > 2. Better use the list form of system:
> >
> > system("rm", "-fr", $path);
> >
> > With the string version, you're risking code injection:
> >
> > http://shlomif-tech.livejournal.com/35301.html
> >
> > Regards,
> >
> > Shlomi Fish
> >
> > >
> > >
> > > > Message du 27/06/11 13:59
> > > > De : "Irfan Sayed"
> > > > A : "Shlomi Fish"
> > > > Copie à : "Perl Beginners"
> > > > Objet : Re: rmdir
> > > >
> > > > i did that but no luck
> > > > is there any another way ?
> > > >
> > > > regards
> > > > irfan
> > > >
> > > >
> > > >
> > > > ________________________________
> > > > From: Shlomi Fish
> > > > To: Irfan Sayed
> > > > Cc: Perl Beginners
> > > > Sent: Monday, June 27, 2011 5:05 PM
> > > > Subject: Re: rmdir
> > > >
> > > >
> > > >
> > > >
> > > > Shlomi Fish (shlomif@shlomifish.org) added themselves to your Guest
> List |
> > > > Remove them | Block them
> > >
> > > Une messagerie gratuite, garantie à vie et des services en plus,=
ça
> vous
> > > tente ? Je crée ma boîte mail www.laposte.net
> > >
> >
> >
> >
> > --
> > ------------------------------------------------------------ -----
> > Shlomi Fish http://www.shlomifish.org/
> > Why I Love Perl - http://shlom.in/joy-of-perl
> >
> > Chuck Norris writes understandable Perl code.
> >
> > Please reply to list if it's a mailing list post - http://shlom.in/repl=
y.
> >
>
> Une messagerie gratuite, garantie à vie et des services en plus, =C3=
=A7a vous
> tente ?
> Je crée ma boîte mail www.laposte.net
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>
>
>
Ifran,

Could you please post some code so people could actually see what you have
tried or are trying. I know it seems simple and easy but clearly is is not
as simple as it seems as you can't get it working so please do not assume
that others will just suggest a fix for you.

Oh, and I suggest you read the documentation a little bit on rmdir... as it
holds some clues to what it is that you will want to be doing. Link to
documentation it mentions
File::Path and rmtree as a solution to your problem.

Regards,

Rob

--0015175771dc15039f04a6b0e380--

Re: rmdir

am 27.06.2011 15:07:51 von pangj

Won't system "rm -rf /path/to/dir" just work for you?



> Message du 27/06/11 13:59
> De : "Irfan Sayed"=20
> A : "Shlomi Fish"=20
> Copie à : "Perl Beginners"=20
> Objet : Re: rmdir
>
> i did that but no luck
> is there any another way ?
>=20
> regards
> irfan
>=20
>=20
>=20
> ________________________________
> From: Shlomi Fish=20
> To: Irfan Sayed=20
> Cc: Perl Beginners=20
> Sent: Monday, June 27, 2011 5:05 PM
> Subject: Re: rmdir
>=20
>=20
>=20
>=20
> Shlomi Fish (shlomif@shlomifish.org) added themselves to your Guest List =
| Remove them | Block them=20

Une messagerie gratuite, garantie à vie et des services en plus, =C3=
=A7a vous tente ?
Je crée ma boîte mail www.laposte.net

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: rmdir

am 27.06.2011 15:31:19 von pangj

Hi Fish,

In my example (there is no metachar), the two forms of system call are the =
same.
from perldoc -f system:

If there is only one scalar
argument, the argument is checked for shell metacharacters, and if there ar=
e any, the entire argument is passed
to the system's command shell for parsing (this is "/bin/sh -c" on Unix pla=
tforms, but varies on other
platforms). If there are no shell metacharacters in the argument, it is spl=
it into words and passed directly to
"execvp", which is more efficient.




> Message du 27/06/11 14:23
> De : "Shlomi Fish"=20
> A : pangj@laposte.net
> Copie à : "Irfan Sayed" , "Perl Beginners"=20
> Objet : Re: rmdir
>
> Hi Pangj,
>=20
> On Mon, 27 Jun 2011 14:07:51 +0100
> pangj@laposte.net wrote:
>=20
> >=20
> > Won't system "rm -rf /path/to/dir" just work for you?
> >=20
>=20
> 1. This is on Windows, so "rm" may not be available. perldoc -f system in
> general is not portable.
>=20
> 2. Better use the list form of system:
>=20
> system("rm", "-fr", $path);
>=20
> With the string version, you're risking code injection:
>=20
> http://shlomif-tech.livejournal.com/35301.html
>=20
> Regards,
>=20
> Shlomi Fish
>=20
> >=20
> >=20
> > > Message du 27/06/11 13:59
> > > De : "Irfan Sayed"=20
> > > A : "Shlomi Fish"=20
> > > Copie à : "Perl Beginners"=20
> > > Objet : Re: rmdir
> > >
> > > i did that but no luck
> > > is there any another way ?
> > >=20
> > > regards
> > > irfan
> > >=20
> > >=20
> > >=20
> > > ________________________________
> > > From: Shlomi Fish=20
> > > To: Irfan Sayed=20
> > > Cc: Perl Beginners=20
> > > Sent: Monday, June 27, 2011 5:05 PM
> > > Subject: Re: rmdir
> > >=20
> > >=20
> > >=20
> > >=20
> > > Shlomi Fish (shlomif@shlomifish.org) added themselves to your Guest L=
ist |
> > > Remove them | Block them=20
> >=20
> > Une messagerie gratuite, garantie à vie et des services en plus, =
ça vous
> > tente ? Je crée ma boîte mail www.laposte.net
> >=20
>=20
>=20
>=20
> --=20
> ------------------------------------------------------------ -----
> Shlomi Fish http://www.shlomifish.org/
> Why I Love Perl - http://shlom.in/joy-of-perl
>=20
> Chuck Norris writes understandable Perl code.
>=20
> Please reply to list if it's a mailing list post - http://shlom.in/reply =
..
>=20

Une messagerie gratuite, garantie à vie et des services en plus, =C3=
=A7a vous tente ?
Je crée ma boîte mail www.laposte.net

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: rmdir

am 27.06.2011 15:49:14 von Irfan Sayed

--0-677056094-1309182554=:58460
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

exactly. some of the files have set the attribute as read only and du=
e to that module was unable to delete those is there any module which=
will check if the file has read only attribute and if yes remove that attr=
ibute?? plz suggest --irfan _________________________=
_______=0AFrom: Shawn H Corey =0ATo: beginners@perl.=
org=0ASent: Monday, June 27, 2011 6:09 PM=0ASubject: Re: rmdir On 11-0=
6-27 08:29 AM, Irfan Sayed wrote:=0A> even i tried windows del command=0A> =
but it prompts for confirmation to delete the files=0A> do u know how to su=
ppress these prompts ? i did not find any switch which allows you to suppre=
ss=0A> It sounds like some of the files or directories have their rea=
d-only bit set. What is the output of this: use File::Path;=0Amy =
$errors =3D [];=0Armtree( $dir, { error =3D> \$errors });=0Aprint "$_\n" fo=
r @$errors; BTW, I do believe the correct Windows command is:=A0 del /=
s =0A-- Just my 0.00000002 million dollars worth,   Shawn Con=
fusion is the first step of understanding. Programming is as much abou=
t organization and communication=0Aas it is about coding. The secret t=
o great software:=A0 Fail early & often. Eliminate software piracy:=A0=
use only FLOSS. -- To unsubscribe, e-mail: beginners-unsubscribe@perl=
..org=0AFor additional commands, e-mail: beginners-help@perl.org=0Ahttp://le=
arn.perl.org/
--0-677056094-1309182554=:58460--

Re: rmdir

am 27.06.2011 15:52:10 von Rob Coops

--0015175771dcd4476704a6b1dc50
Content-Type: text/plain; charset=UTF-8

On Mon, Jun 27, 2011 at 3:49 PM, Irfan Sayed wrote:

> exactly. some of the files have set the attribute as read only
>
> and due to that module was unable to delete those
>
> is there any module which will check if the file has read only attribute
> and if yes remove that attribute??
>
> plz suggest
>
> --irfan
>
>
>
> ________________________________
> From: Shawn H Corey
> To: beginners@perl.org
> Sent: Monday, June 27, 2011 6:09 PM
> Subject: Re: rmdir
>
> On 11-06-27 08:29 AM, Irfan Sayed wrote:
> > even i tried windows del command
> > but it prompts for confirmation to delete the files
> > do u know how to suppress these prompts ? i did not find any switch which
> allows you to suppress
> >
>
> It sounds like some of the files or directories have their read-only bit
> set.
>
> What is the output of this:
>
> use File::Path;
> my $errors = [];
> rmtree( $dir, { error => \$errors });
> print "$_\n" for @$errors;
>
> BTW, I do believe the correct Windows command is: del /s
>
>
> -- Just my 0.00000002 million dollars worth,
> Shawn
>
> Confusion is the first step of understanding.
>
> Programming is as much about organization and communication
> as it is about coding.
>
> The secret to great software: Fail early & often.
>
> Eliminate software piracy: use only FLOSS.
>
> -- To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>

Have a look at the following: Win32::File (to get and set file attributes on
Windows)

--0015175771dcd4476704a6b1dc50--

Re: rmdir

am 27.06.2011 16:13:27 von Shlomi Fish

Hi Pangj,

On Mon, 27 Jun 2011 14:31:19 +0100
pangj@laposte.net wrote:

> Hi Fish,

Since â€=9CFishâ€=9D is my last name, it should be "Hi Mr. Fish,", =
or perhaps "Hi
Shlomi". See:

http://www.joelonsoftware.com/articles/ResumeRead.html

<<<<
In most of the English speaking world it is not considered polite to open
letters to a Mr. Joel Spolsky by writing "Dear Spolsky." One might write "D=
ear
Mr. Spolsky," or "Dear sir," or perhaps, "Hi Joel!" But "Dear Spolsky" is
usually followed by some story about embezzled funds and needing to borrow =
my
bank account.=20
>>>>

>=20
> In my example (there is no metachar), the two forms of system call are the
> same. from perldoc -f system:
>=20
> If there is only one scalar
> argument, the argument is checked for shell metacharacters, and if there =
are
> any, the entire argument is passed to the system's command shell for pars=
ing
> (this is "/bin/sh -c" on Unix platforms, but varies on other platforms). =
If
> there are no shell metacharacters in the argument, it is split into words=
and
> passed directly to "execvp", which is more efficient.
>=20

You are right in this simple case. However, let's say you're doing:

system("rm -fr $path");

Where $path is input from the user? This may contain shell metachars and th=
ey
may do a world of damage. So it's better to use:

system('rm', '-fr', $path);

Regards,

Shlomi Fish=20

>=20
>=20
>=20
> > Message du 27/06/11 14:23
> > De : "Shlomi Fish"=20
> > A : pangj@laposte.net
> > Copie à : "Irfan Sayed" , "Perl Beginners"=20
> > Objet : Re: rmdir
> >
> > Hi Pangj,
> >=20
> > On Mon, 27 Jun 2011 14:07:51 +0100
> > pangj@laposte.net wrote:
> >=20
> > >=20
> > > Won't system "rm -rf /path/to/dir" just work for you?
> > >=20
> >=20
> > 1. This is on Windows, so "rm" may not be available. perldoc -f system =
in
> > general is not portable.
> >=20
> > 2. Better use the list form of system:
> >=20
> > system("rm", "-fr", $path);
> >=20
> > With the string version, you're risking code injection:
> >=20
> > http://shlomif-tech.livejournal.com/35301.html
> >=20
> > Regards,
> >=20
> > Shlomi Fish


--=20
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
Funny Anti-Terrorism Story - http://shlom.in/enemy

There was one Napoleon, one George Washington, and one me!
â€=94 Big Boy Caprice in
http://en.wikiquote.org/wiki/Dick_Tracy_%281990_film%29

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: rmdir

am 27.06.2011 16:37:03 von Irfan Sayed

--0-2147462595-1309185423=:50688
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

how to unset the read-only attribute using win32::file module=0Athere r i g=
uess only two methods 1: Getattributes=0A2: setattributes but th=
e attribute which is already set, how to unset that ?? =0A____________=
____________________=0AFrom: Rob Coops =0ATo: Irfan Sayed=
=0ACc: Shawn H Corey ; "=
beginners@perl.org" =0ASent: Monday, June 27, 2011 7:22=
PM=0ASubject: Re: rmdir On Mon, Jun 27, 2011 at 3:49 PM, =
Irfan Sayed wrote: exactly. some of the fi=
les have set the attribute as read only=0A>=0A>and due to that module was u=
nable to delete those=0A>=0A>is there any module which will check if the fi=
le has read only attribute and if yes remove that attribute??=0A>=0A>plz su=
ggest=0A>=0A>--irfan=0A>=0A>=0A>=0A>________________________ ________=0A>Fro=
m: Shawn H Corey =0A>To: beginners@perl.org=0A>Sent:=
Monday, June 27, 2011 6:09 PM=0A>Subject: Re: rmdir=0A>=0A>=0A>On 11-06-27=
08:29 AM, Irfan Sayed wrote:=0A>> even i tried windows del command=0A>> bu=
t it prompts for confirmation to delete the files=0A>> do u know how to sup=
press these prompts ? i did not find any switch which allows you to suppres=
s=0A>>=0A>=0A>It sounds like some of the files or directories have their re=
ad-only bit set.=0A>=0A>What is the output of this:=0A>=0A>use File::Path;=
=0A>my $errors =3D [];=0A>rmtree( $dir, { error =3D> \$errors });=0A>print =
"$_\n" for @$errors;=0A>=0A>BTW, I do believe the correct Windows command i=
s:=A0 del /s=0A>=0A>=0A>-- Just my 0.00000002 million dollars worth,=0A>=A0=
Shawn=0A>=0A>Confusion is the first step of understanding.=0A>=0A>Programm=
ing is as much about organization and communication=0A>as it is about codin=
g.=0A>=0A>The secret to great software:=A0 Fail early & often.=0A>=0A>Elimi=
nate software piracy:=A0 use only FLOSS.=0A>=0A>-- To unsubscribe, e-mail: =
beginners-unsubscribe@perl.org=0A>For additional commands, e-mail: beginner=
s-help@perl.org=0A>http://learn.perl.org/ Have a look at the following=
: Win32::File (to get and set file attributes on Windows)
--0-2147462595-1309185423=:50688--

Re: rmdir

am 27.06.2011 17:09:24 von Ron Bergin

Irfan Sayed wrote:
> even i tried windows del command
> but it prompts for confirmation to delete the files
> do u know how to suppress these prompts ? i did not find any switch whi=
ch
> allows you to suppress
>
> pls suggest.
>
> regards
> irfan
>

You need to use the /s and /q and /f options.

/F Force deleting of read-only files.
/S Delete specified files from all subdirectories.
/Q Quiet mode, do not ask if ok to delete on global wildcard

--=20
Ron Bergin



--=20
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

RE: rmdir

am 27.06.2011 17:14:49 von kwanseon.park

I am using SNMP with Perl.
I got below message"=20
Can't locate NetSNMP/OID.pm in @INC (@INC contains: C:/Perl/site/lib
C:/Perl/lib .)"
Even I install Net:SNMP Modules..
When I check the SNMP Modules, there is no Net:SNMP:OID Module.
How can I install? Or load this module from CPAN?

Thanks

Kwan
=20

-----Original Message-----
From: Ron Bergin [mailto:rkb@i.frys.com]=20
Sent: Monday, June 27, 2011 10:09 AM
To: Irfan Sayed
Cc: Shlomi Fish; pangj@laposte.net; Perl Beginners
Subject: Re: rmdir

Irfan Sayed wrote:
> even i tried windows del command
> but it prompts for confirmation to delete the files
> do u know how to suppress these prompts ? i did not find any switch
which
> allows you to suppress
>
> pls suggest.
>
> regards
> irfan
>

You need to use the /s and /q and /f options.

/F Force deleting of read-only files.
/S Delete specified files from all subdirectories.
/Q Quiet mode, do not ask if ok to delete on global
wildcard

--=20
Ron Bergin



--=20
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/



--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: rmdir

am 27.06.2011 17:33:51 von Irfan Sayed

--0-1671020036-1309188831=:48312
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

i need that command which will delete all files and directoreis recursivley=
along with root dir and read only files i did in this way C:\>=
del /F /S /Q c:\test but c:\ still has test folder and subfolder=0Ausi=
ng above command only files are getting deleted and not empty folders =
plz suggest =0A________________________________=0AFrom: Ron Ber=
gin =0ATo: Irfan Sayed =0ACc: Sh=
lomi Fish ; "pangj@laposte.net" =
; Perl Beginners =0ASent: Monday, June 27, 2011 8:39 PM=
=0ASubject: Re: rmdir Irfan Sayed wrote:=0A> even i tried windows del =
command=0A> but it prompts for confirmation to delete the files=0A> do u kn=
ow how to suppress these prompts ? i did not find any switch which=0A> allo=
ws you to suppress=0A>=0A> pls suggest.=0A>=0A> regards=0A> irfan=0A> =
You need to use the /s and /q and /f options. =A0 /F=A0 =A0 =A0 =A0 =
=A0 =A0 Force deleting of read-only files.   /S=A0 =A0 =A0 =A0 =A0 =A0 =
Delete specified files from all subdirectories.   /Q=A0 =A0 =A0 =A0 =A0=
=A0 Quiet mode, do not ask if ok to delete on global wildcard -- =0AR=
on Bergin -- =0ATo unsubscribe, e-mail: beginners-unsubscribe@pe=
rl.org=0AFor additional commands, e-mail: beginners-help@perl.org=0Ahttp://=
learn.perl.org/
--0-1671020036-1309188831=:48312--

Re: rmdir

am 27.06.2011 17:59:15 von Ron Bergin

Irfan Sayed wrote:
> i need that command which will delete all files and directoreis
> recursivley along with root dir and read only files
>
> i did in this way
>
> C:\>del /F /S /Q c:\test
>
> but c:\ still has test folder and subfolder
> using above command only files are getting deleted and not empty folder=
s
>
> plz suggest
>
>
>
>
> ________________________________
> From: Ron Bergin
> To: Irfan Sayed
> Cc: Shlomi Fish ; "pangj@laposte.net"
> ; Perl Beginners
> Sent: Monday, June 27, 2011 8:39 PM
> Subject: Re: rmdir
>
> Irfan Sayed wrote:
>> even i tried windows del command
>> but it prompts for confirmation to delete the files
>> do u know how to suppress these prompts ? i did not find any switch
>> which
>> allows you to suppress
>>
>> pls suggest.
>>
>> regards
>> irfan
>>
>
> You need to use the /s and /q and /f options.
>
> =A0 /F=A0 =A0 =A0 =A0 =A0 =A0 Force deleting of read-only files.
> =A0 /S=A0 =A0 =A0 =A0 =A0 =A0 Delete specified files from all subdirect=
ories.
> =A0 /Q=A0 =A0 =A0 =A0 =A0 =A0 Quiet mode, do not ask if ok to delete on=
global wildcard
>
> --

Since rmdir doesn't have the /F switch, simply use 2 commands. The firs=
t
one uses "del /s /f /q" to delete the files and the second uses "rmdir /s
/q" to delete the directories.

--
Ron Bergin
aka Fishmonger


--=20
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

RE: rmdir

am 27.06.2011 18:45:54 von Ken Slater

> From: Irfan Sayed
> To: Perl Beginners
> Sent: Friday, June 24, 2011 3:13 PM
> Subject: rmdir
>=20
> hi,
> i need to delete some directories recursively which are present at =
some
> shared location
>=20
> i tried file::path perl module but the issue with that module is , it
> is not deleting the root/parent dir
>=20
> it deletes the subdirectories and all the files inside that but not
> removing root dir
>=20
> here is my code:
> =A0$path =3D "\\\\build\\" . "f\$" .
> "\\Store\\build\\Internal_Builds\\Daily_Builds\\Daily\\zoc\\ " .
> $hash_fin{$key};
>=20
> =A0print "$path\n";
> =A0print "**********\n";
> =A0 remove_tree($path,{verbose =3D> 1,safe =3D> 1,keep_root =3D> 0});
>=20
> now whaat i expect is , module shud delete the dir which is there in
> $path but it does not
> plz suggest
>=20
>=20
> regards
> Irfan

Since you have 'verbose' set, you should be seeing a message on the =
console
as each file is deleted.
You should see such a message for the 'root' directory.
Do you see such a message?
If you do, is there an error message being printed indicating there is a
problem removing the directory? Can you remove it manually (and what =
happens
if you can't)?
Don't be concerned with the read-only attribute being set on a directory =
in
Windows.
That attribute is ignored for directories.
There could be a permission problem, a file open in the folder, etc.
Also, post a complete working example when you post code. That may =
provide a
clue.
HTH,
Ken



--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: rmdir

am 27.06.2011 20:24:00 von Rob Dixon

On 24/06/2011 10:43, Irfan Sayed wrote:
>
> i need to delete some directories recursively which are present at
> some shared location
>
> i tried file::path perl module but the issue with that module is , it
> is not deleting the root/parent dir
>
> it deletes the subdirectories and all the files inside that but not
> removing root dir
>
> here is my code:
> $path = "\\\\build\\" . "f\$" . "\\Store\\build\\Internal_Builds\\Daily_Builds\\Daily\\zoc\\ " . $hash_fin{$key};
>
> print "$path\n";
> print "**********\n";
> remove_tree($path,{verbose => 1,safe => 1,keep_root => 0});
>
> now whaat i expect is , module shud delete the dir which is there in
> $path but it does not
>

I wonder if you are misunderstanding the keep_root option? Your code
should delete the folder named in $hash_fin{$key} and everything beneath
it. The tree down to 'zoc' should remain unchanged.

Setting safe to true won't help - all it does is prevent remove_tree
from altering file permissions in order to delete elements in the tree.

Note that \\build\f$ is a shared name, not a folder, and cannot be
deleted by rmdir.

You should change your code to

remove_tree($path, {verbose => 1, safe => 0, keep_root => 0}) or die $!;

to show if there are any errors.

HTH,

Rob

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: rmdir

am 28.06.2011 13:40:46 von Irfan Sayed

--0-330244022-1309261246=:47042
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Awsome!!!=0Athis works fine . Rob you rock thanks a lot. --irfan=
________________________________=0AFrom: Rob Dixon mx.com>=0ATo: Perl Beginners =0ACc: Irfan Sayed sayed2002@yahoo.com>=0ASent: Monday, June 27, 2011 11:54 PM=0ASubject: Re: =
rmdir On 24/06/2011 10:43, Irfan Sayed wrote:=0A> =0A> i need to delet=
e some directories recursively which are present at=0A> some shared locatio=
n=0A> =0A> i tried file::path perl module but the issue with that module is=
, it=0A> is not deleting the root/parent dir=0A> =0A> it deletes the subdi=
rectories and all the files inside that but not=0A> removing root dir=0A> =
=0A> here is my code:=0A>=A0 $path =3D "\\\\build\\" . "f\$" . "\\Store\\b=
uild\\Internal_Builds\\Daily_Builds\\Daily\\zoc\\" . $hash_fin{$key};=0A>=
=A0 =0A>=A0 print "$path\n";=0A>=A0 print "**********\n";=0A>=A0 =A0 remo=
ve_tree($path,{verbose =3D>=A0 1,safe =3D>=A0 1,keep_root =3D>=A0 0});=0A> =
=0A> now whaat i expect is , module shud delete the dir which is there in=
=0A> $path but it does not=0A> I wonder if you are misunderstanding th=
e keep_root option? Your code=0Ashould delete the folder named in $hash_fin=
{$key} and everything beneath=0Ait. The tree down to 'zoc' should remain un=
changed. Setting safe to true won't help - all it does is prevent remo=
ve_tree=0Afrom altering file permissions in order to delete elements in the=
tree. Note that \\build\f$ is a shared name, not a folder, and cannot=
be=0Adeleted by rmdir. You should change your code to =A0 remove=
_tree($path, {verbose =3D> 1, safe =3D> 0, keep_root =3D> 0}) or die $!;=0A=
=0Ato show if there are any errors. HTH, Rob
--0-330244022-1309261246=:47042--