Solved

How do I make my web server copy a file?

Posted on 1998-08-13
2
146 Views
Last Modified: 2010-03-05
I have an NT4 server running IIS3 and I have perl for win32 loaded on it. I have a form in a web page an when the user clicks on 'submit' I need my perl script to copy a file from one place to another on the web server itself, not on the client side.

I have tried the following, and they don't give errors, they just ignore the command.

system ("copy c:\test d:\test");
system ("cp c:\test d:\test");
cp "c:\test" "d:\test";
copy "c:\test" d:\test";
copy "c:\test d:\test";

Has anyone ever done this or know the correct syntax if it is possible?

Thanks.
0
Comment
Question by:johnsm
2 Comments
 
LVL 4

Accepted Solution

by:
mitek earned 50 total points
ID: 1209268
i was about to write "most likely, it's permission problem", but it looks like it's much simpler.

i would suspect that backslash in
system ("copy c:\test d:\test"); is interpreted as a tab ( \t ),
so the names the copy command sees are totally bogus.

so, to "copy" it looks like "copy c:  est d:  est"

i would either double backslash or used single quotes

system ("copy c:\\test d:\\test");
system ('copy c:\test d:\test');
 
             

0
 
LVL 1

Author Comment

by:johnsm
ID: 1209269
Wow! Both suggestions worked fine.

I'm kinda new to this perl thing and I didn't even think of those.

Thanks a lot for your help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
use perl to insert into MySQL database 9 128
binary to char / hexadecimal 5 104
get the last nth lines from a an array if nth element is xxx 2 68
Regular Expression for URL 10 91
On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now