Re: Question about copying files.

perldoc file::copy

>>> <mystic_mac1@mac.com> 07/02/02 08:40am >>>
I've got a script that parses out a mail file into an array then uses 
the print command to copy the array to another location. Effectively
I'm 
just copying one file from its original location to another location, 
I'm using a cgi script to do this in, how can I call a "cp" command
from 
within a cgi script? I'm thinking of doing something like:

sh "cp filename1.txt /new/path/filename2.txt";

Would this be enough, or do I have to require another .pl script from 
Perl? Totally lost here, so any help would be appreciated.

His Faithful Servant,
Mark


-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org 
For additional commands, e-mail: beginners-help@perl.org 



ITM Business Solutions
Unit 4
Nine Trees Trading Estate
Morthen Road
Rotherham
S66 9JG

Reception
Tel: 01709 703288
Fax: 01709 701549

Help Desk
Tel:01709 530424
Fax: 01709 702159

CONFIDENTIALITY NOTICE: This message is intended only for the use of
the individual or entity to which it is addressed, and may contain
information that is privileged, confidential and exempt from disclosure
under applicable law.


0
Nigel
7/2/2002 8:47:45 AM
perl.beginners 29388 articles. 4 followers. Follow

3 Replies
446 Views

Similar Articles

[PageSpeed] 35

I would suggest using file::copy instead of `cp` for security reasons,
especially within a CGI script. (and it's more portable)

>>> <mystic_mac1@mac.com> 07/02/02 08:40am >>>
I've got a script that parses out a mail file into an array then uses 
the print command to copy the array to another location. Effectively
I'm 
just copying one file from its original location to another location, 
I'm using a cgi script to do this in, how can I call a "cp" command
from 
within a cgi script? I'm thinking of doing something like:

sh "cp filename1.txt /new/path/filename2.txt";

Would this be enough, or do I have to require another .pl script from 
Perl? Totally lost here, so any help would be appreciated.

His Faithful Servant,
Mark


-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org 
For additional commands, e-mail: beginners-help@perl.org 



ITM Business Solutions
Unit 4
Nine Trees Trading Estate
Morthen Road
Rotherham
S66 9JG

Reception
Tel: 01709 703288
Fax: 01709 701549

Help Desk
Tel:01709 530424
Fax: 01709 702159

CONFIDENTIALITY NOTICE: This message is intended only for the use of
the individual or entity to which it is addressed, and may contain
information that is privileged, confidential and exempt from disclosure
under applicable law.


0
Nigel
7/2/2002 8:50:37 AM
on Tue, 02 Jul 2002 08:50:37 GMT, Nigel Peck wrote:

> I would suggest using file::copy instead of `cp` for security reasons,
> especially within a CGI script. (and it's more portable)

Except it isn't file::copy but File::Copy.

-- 
felix
0
felix_geerinckx
7/2/2002 8:55:14 AM
Yes you're right, sorry. (darn case sensitivity :-)

>>> Felix Geerinckx <felix_geerinckx@hotmail.com> 07/02/02 09:55am >>>
on Tue, 02 Jul 2002 08:50:37 GMT, Nigel Peck wrote:

> I would suggest using file::copy instead of `cp` for security
reasons,
> especially within a CGI script. (and it's more portable)

Except it isn't file::copy but File::Copy.

-- 
felix

-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org 
For additional commands, e-mail: beginners-help@perl.org 



ITM Business Solutions
Unit 4
Nine Trees Trading Estate
Morthen Road
Rotherham
S66 9JG

Reception
Tel: 01709 703288
Fax: 01709 701549

Help Desk
Tel:01709 530424
Fax: 01709 702159

CONFIDENTIALITY NOTICE: This message is intended only for the use of
the individual or entity to which it is addressed, and may contain
information that is privileged, confidential and exempt from disclosure
under applicable law.


0
Nigel
7/2/2002 10:28:07 AM
Reply:

Similar Artilces:

File.Copy and File.CopyTo DO NOT COPY CONTENTS OF FILE!@
I posted on here before but no one has been of any help. I am trying to copy files of type .zip .jpg and .pdf from ones folder to another (I dont want to move it, just make a copy). How can I do this? When I use File.Copy and File.CopyTo it makes a new file in the right folder but has no content and it also erases the content on the orignal file. WTF? This is really making me mad. Visit VistaForums.com #1 Windows Vista Forum Here you go --->  http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=207Regards, Narayana Rao Surapaneni Architect | Author | MCSD for .NET | MCSD | SCJP ww...

Re: RE: Records put into a hash
I would actually prefere the first way, since each level of indirection in the second call adds an overhead on performance, nothing major, but in a simple case like this, i dont' see any reason why it shouldn't be eliminated. ----- Original Message ----- From: kimball@stsci.edu (Timothy Kimball) Date: Monday, June 4, 2001 4:00 pm Subject: RE: Records put into a hash - Beginner Question > > Joel Stout wrote: > : Many thanks, one last tidbit: > : Is it better to : > : > : %Fields = %{$Accts{$account}}; > : foreach $name ( keys %Fields ) { >...

Copying all files in a directory using either file.copy or directory.copy across volumes
I need to copy all the files from a cd directory to a directory on my harddrive. I have tried the directory.copy method but it will not allow me to copy across volumes. I have tried the file.copy method but you must specify a file name in the path as well as the target. This sort of defeats the purpose of what I am trying to do. Basically I am using a radio button to specify a type of CD and based on this selection the application knows what directory to look in for the files I want. Here is the script I tried last to move the file. Sub KPacs(ByVal sender As Object, ByVal e As System.EventA...

copy file question
We would like to implement some version control in our PB apps. We have sucessfully saved and then retrieved the current version of the app from the PB.ini file. We have also connected to the database and retrieved the value of what should be the current version of the PB app. At this time we would like to make a call to a subroutine to copy all files necessary for the app from our server to the clients PC if the versions are different and then update pb.ini with the new version, log the user off the app so when they logged back on they would be executing the newest version. We have a ....

File Copy Question
I have recently been assigned a task of reengineering some old PowerBuilder code to a new version and to clean up the old code. I noticed that the original developer copied a file into a blob then wrote the blob out to a different location. Is there some reason behind this or is the developer just being creative, wouldn't it be cleaner and faster just to use a FileCopy? Thanks in advance The FileCopy function was added in version 8. The program could have been written in an older version. "Doug" <dklee@schmidt.com> wrote in message news:1165351494.2...

Copying more than one file using File::Copy
Good day=3B I apologize in advance if this is a very stupid question=85 I=27m trying to concatenate two files and have the results written to a = third file=2E = Maybe I=27m missing something obvious=2E=2E=2E but in Perldoc for File=3A= =3ACopy I = read=3A =22The copy function takes two parameters=3A a file to copy from = and = a file to copy to=2E=22 What can I do if I have a second file I want to copy from=3F (i=2Ee=2E Li= ke = DOS copy command=3A c=3A=5C file1=2Etxt + file2=2Etxt file3=2Etxt will co= py the = contents of file1=2Etxt =26 file2=2Etxt and put the...

File::Copy question
I am using Windows 98 and ActiveState Perl. I have a log file that after a certain size is truncated and reused. I have written a simple script to copy that file to another file using File::Copy. Is there a way to make sure the second file is appended instead of overwritten, using File::Copy or do I need to use something else? ----- The three most dangerous things are a programmer with a soldering iron, a manager who codes, and a user who gets ideas. ---- If you want to append the contents of one file to another, then you will have to open both files, read the firs...

Re: File::Copy use of sysread (Re: I'm losing the war...)
> Either we define them as forcedly explicit "bytes-speak" or we won't have > read(2)/write(2) access any more from Perl. Also, how about socket I/O? > If I send() a Unicode $blah down the socket, what bytes and how many of > them are sent? I'd say it doesn't make a difference if you use send() syswrite() or print(), what goes out goes through the appropriate filtering of the IO layers, which may be a no-op if the file handle is running in binary mode. If the file handle is in text mode, $blah would be encoded to whatever encoding is active for that h...

Re: Copying files
> Hi, > > Thanks all for the help on the mail question a few days back. That's > fixed. Now I've run into another problem. I'm trying to copy a file on > a local network (off a PC) to my Mac. But when the script is called > from within cron, it seems that the script doesn't run. The cron looks > like this: > > * * * * * /Users/xxxx/Library/Scripts/backup.pl > > The script is as follows: > > #!/usr/bin/perl -w > > use strict; > > my @files = "db1.txt, db2.txt, db3.txt, db4.txt"; > > f...

Re: Encrypt a file, was Re: Encrpt a file
On Mon, 18 Apr 2005, Anish Kumar K wrote: > Can [anyone] suggest a good algorithm for [encrypting] and > [decrypting] files ..I donot want to use any perl module for that... Check out the perl stuff on this site. I haven't actually used it yet, though I've been meaning to look at it. But their Java stuff is really good. http://www.cryptix.org/ Not sure why you don't want to use a module, but you could always pull out the parts you need. ****** CONFIDENTIALITY NOTICE ****** NOTICE: This e-mail message and all attachments transmitted with it may con...

File::Copy::copy() dies on identical files?
I'm giving File::Copy's tests a bit of a face-lift and I came across this: eval { copy("copy-$$", "copy-$$") }; printf "ok %d\n", 15+$loopconst unless $@ =~ /are identical/ && -s "copy-$$"; which basically says, "copy() should die if given the same source and destination file" which is a little extreme. Warn perhaps, but not die. I think it's just parroting the behavior of the 'cp' shell command. If nobody has any objections, I'll downgrade that to a warning and copy() just succeeds. P...

File.Copy does not release the lock on the copied file.
 Hi! I am trying to use the File.Copy function in order to copy a file from the Client's PC to the Server. The File to be copied is selected by the user using the FileUpload control and is then used by the server to perform certain operations. My problem is that when I copy the file using the File.Copy method and then execute a streamreader process on the file straight after, I get the following error; "The process cannot access the file '\\syddev1\latest\xmasEmail.html' because it is being used by another process. " Below is the piece of code where the problem...

copying a file without using module File::Copy
Hello All, Is the only way to copy a file from one directory to another by using the copy module...? Would anyone have a snipet of code copying a file from one dir to another... Any assistance would be appreciated... Thank you, Mike ------------------------------------------------ On Fri, 14 Feb 2003 10:13:06 -0500, Michael Pastore <Michael.Pastore@frontstep.com> wrote: > > Hello All, > > Is the only way to copy a file from one directory to another by using the > copy module...? > > Would anyone have a snipet of code copying a f...

Problems with File.Copy() Method for copy big files
I´m using the follow commando to copy a file: source = "c:\\domains\\pagina.com.br\\wwwroot\\folder\\filesou.xml";target = "c:\\domains\\pagina.com.br\\wwwroot\\folder\\filetar.xmb"; File.Copy(source, target, true); If I used a small file (source) with for example 233000 bytes the server copy to target without problems. But if I used the file (source) with 700000 bytes the server don´t copy. I´ m copy to the same folder... Why is this happened with big file as source ? Thank you... Rogério Does it throw any error. HighOnCodingWanna get high! I don´t know if it throw any error.Ho...

Web resources about - Re: Question about copying files. - perl.beginners

West Lothian question - Wikipedia, the free encyclopedia
He illustrated his point by pointing out the absurdity of a Member of Parliament for West Lothian being able to vote on matters affecting the ...

New questions about San Bernardino shooters
The FBI says that the couple was radicalized and took target practice before the shooting. Melissa Chan reports.

Astronomers question claim of super planet found at solar system’s edge
The ALMA Telescope’s antennas are seen under a starry night sky. (credit: Christoph Malin) Scientists and amateur astronomers have long been ...

Submit your questions for Autoblog Podcast #458
Filed under: Podcasts On Episode #458 of the Autoblog Podcast, we'll discuss (argue about) the 2015 North American Car and Truck/Utility of the ...

"Donald Trump's reprehensible call to bar Muslim immigrants from entering the United States tracks an ...
"Would such a proposal be constitutional? The answer is not what you might think..." Unless you've read all the many other op-eds dotted about ...

Media moral posing and the unasked Trump question
Media moral posing and the unasked Trump question by digby I wrote about Trump and the media today for Salon. Here's an excerpt in which I discuss ...

The cofounder of a $750 million startup shares the question he asks investors to test their motives
Shaving startup Harry's , at just two-and-half years old, is still a baby by corporate standards, but it has some serious momentum behind it. ...

Report: Cruz questions Trump's "judgment" to be president
At a private fundraiser, Cruz remarked on Trump and Carson and their preparedness to be commander-in-chief, according to the New York Times

Paris Climate Agreement’s Legal Form Explained In 7 Questions
Originally published on WRI. By Eliza Northrop and David Waskow What will be the outcome of the Paris climate negotiations — an agreement? A ...

IDG Contributor Network: Stretch, tackle and question: One CTO's career advice
Dr. Darlene Solomon is chief technology officer for Agilent Technologies , advancing chemical and biological measurements in the life sciences, ...

Resources last updated: 12/10/2015 10:44:30 PM