Solved

How do I make my web server copy a file?

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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 …
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 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

13 Experts available now in Live!

Get 1:1 Help Now