Copy using system

L

lerameur

hello,
I wrote a small script in perl.
this is the line that is buggy:

mkdir ("/ins/$Out_directory/aux", 0777);
system(`cp -p * /dir/$Out_directory/aux `);

I use the above command , the files do get copied, but the command do
not exit once it is finished. It just hangs there and do not proceed,
I need to hit ctlr-Z . no error message. what is wrong


ken
 
J

J. Gleixner

lerameur said:
hello,
I wrote a small script in perl.
this is the line that is buggy:

mkdir ("/ins/$Out_directory/aux", 0777);
system(`cp -p * /dir/$Out_directory/aux `);

I use the above command , the files do get copied, but the command do
not exit once it is finished. It just hangs there and do not proceed,
I need to hit ctlr-Z . no error message. what is wrong

1. Check if mkdir was successful.
2. Use double-quotes.
 
J

Jürgen Exner

lerameur said:
I wrote a small script in perl.
this is the line that is buggy:

mkdir ("/ins/$Out_directory/aux", 0777);
system(`cp -p * /dir/$Out_directory/aux `);

Why are you using the output of the cp command as the argument for system()?
I highly doubt that is what you meant to do.

Anyway, if you want to copy files then you may want to check the File::Copy
module.

jue
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top