How do I do this one-liner (windows command) in perl ?

M

Mark

This is all I need to be able to do in Perl:

if exist c:\data\bad\* (move c:\data\)

Thanks.
 
T

Tore Aursand

This is all I need to be able to do in Perl:

if exist c:\data\bad\* (move c:\data\)

What does it mean? I guess 'move' takes two arguments, no? Where do you
want to move things?

Anyway. Take a look at the File::Copy, File::Find and File::Find::Rule
modules. They should help you do the task.
 
M

Mark

What does it mean? I guess 'move' takes two arguments, no? Where do you
want to move things?

The above checks to see if there is anything in c:\data\bad\
If there is, move it to c:\data\
Anyway. Take a look at the File::Copy, File::Find and File::Find::Rule
modules. They should help you do the task.

I've poked around a bit with those, but I'm green as can be with Perl. I was
hoping this would be simple to those who 'know'....
 
P

Paul Lalli

The above checks to see if there is anything in c:\data\bad\
If there is, move it to c:\data\


I've poked around a bit with those, but I'm green as can be with Perl. I was
hoping this would be simple to those who 'know'....

It is. But we are not here to write programs for you. What we are here
(volunteering) for, is to help you with your Perl problems. If you have a
question about the best way to get something done, we point you in the
right direction. If you have a question as to why some piece of code is
not working the way you think it should, we help clarify the code and/or
your thinking. Please do not ask us to do for free what many of us do for
a living.

Look at those modules, make an attempt, and if it doesn't work, show us
where you're running into difficulties, and we'll try to help.

Now that you've clarified the problem a bit, I'm going to suggest you also
take a look at
perldoc perlrun
and search for the -i argument


Paul Lalli
 
M

Mark

It is. But we are not here to write programs for you. What we are here
(volunteering) for, is to help you with your Perl problems. If you have a
question about the best way to get something done, we point you in the
right direction. If you have a question as to why some piece of code is
not working the way you think it should, we help clarify the code and/or
your thinking. Please do not ask us to do for free what many of us do for
a living.

Look at those modules, make an attempt, and if it doesn't work, show us
where you're running into difficulties, and we'll try to help.

Now that you've clarified the problem a bit, I'm going to suggest you also
take a look at
perldoc perlrun
and search for the -i argument


Paul Lalli


Thanks for spending more time writing that up than it would have taken to just
translate the code.

*sigh* Back to google where the usefull information resides.
 
P

Paul Lalli

Thanks for spending more time writing that up than it would have taken to just
translate the code.

*sigh* Back to google where the usefull information resides.

Hahaha. I love people like this. People who are just completely adverse
to reading documentation. The funniest part (to me) is that if Mark had
actually read the perldoc I suggested, he would have actually found the
exact answer, and an example one-liner that does precisely what he wants.

Oh well. Happy Surfing, Mark.

Paul Lalli
 
M

Mark

Hahaha. I love people like this. People who are just completely adverse
to reading documentation. The funniest part (to me) is that if Mark had
actually read the perldoc I suggested, he would have actually found the
exact answer, and an example one-liner that does precisely what he wants.

And, once again, google came through for me. I should have know better to
just start there.

BTW, I just checked your perldoc and the examples shown do NOT do what I want
(as expected). Thanks for playing.

I love people like YOU who are so full of themselves and have a godlike
attitude. You need to come down a few pegs.

It's not up to you to decide to teach me. That's not what I asked for and
have no use for it.

This is a one time deal with me and will not have any use for Perl in the
foreseeable future.

Good luck continuing with your "holier than thou" mission.
 
P

Paul Lalli

And, once again, google came through for me. I should have know better to
just start there.

To start there to get a pre-written program for you? Yes, you absolutely
should have. This isn't the place for it.
BTW, I just checked your perldoc and the examples shown do NOT do what I want
(as expected). Thanks for playing.

<sigh> Please try to read.
As shown above, Perl creates the backup file whether or
not any output is actually changed. So this is just a
fancy way to copy files:

$ perl -p -i '/some/file/path/*' -e 1 file1 file2 file3...
I love people like YOU who are so full of themselves and have a godlike
attitude. You need to come down a few pegs.

It's not up to you to decide to teach me. That's not what I asked for and
have no use for it.

This is a one time deal with me and will not have any use for Perl in the
foreseeable future.

Good luck continuing with your "holier than thou" mission.

Out of pure curiousity, let's do a hypothetical situation. Say you have a
leaky pipe in your bathroom. You come upon a total stranger that you
happen to know is a professional plumber. Do you ask him what kind of
wrench to use to fix it, or do you ask him to come over to your house and
fix it for you (for free, of course)? I'm seriously curious about this.
Maybe I'm the one with the bizzare point of view. I'm willing to accept
that possibility.

But hell, I've gotten into enough flame mini-wars in the past two days to
last quite a while. Reply to this or don't. This will be my final word
on the subject, I promise.

Paul Lalli
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top