Solved

How do I make my web server copy a file?

Posted on 1998-08-13
2
149 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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…

809 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