The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Copying Files and patilmukundraj SUN Solaris 1 12-30-2007 03:04 PM
Copying files in AWK koti_rama Shell Programming and Scripting 4 08-02-2007 01:55 AM
copying files between two accounts hinman UNIX for Dummies Questions & Answers 2 02-06-2007 11:39 PM
Copying files alpheusm UNIX for Dummies Questions & Answers 4 10-18-2002 02:18 AM
copying files from Unix to NT 4.0 Sp5 regimbaldpj UNIX for Advanced & Expert Users 3 11-02-2001 04:03 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-13-2007
BG_JrAdmin BG_JrAdmin is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 141
perl - copying files

Folks, here is my code:

I am a serious newbie, why doesn't this make copies of my files? I dont get any errors, the files are just not created.

Your help is appreciated

#!/usr/bin/perl

use File::Copy;

$PWD = `pwd`;
$REPORTDIR = "/usr/local/tripwire/tfs/report";

chdir $REPORTDIR;

for (`ls /usr/local/tripwire/tfs/report | grep 2007`)
{
copy("$_","copyfile-$_");
}
  #2 (permalink)  
Old 12-13-2007
cbkihong cbkihong is offline Forum Advisor  
Advisor
  
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,624
First, make sure $_ in the loop is really populated with what you expected to get.

Second, capture all the errors. You called copy() but do not follow by die(), so you will never know why the copy failed. Otherwise, the error should tell you why.

File::Copy - perldoc.perl.org
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:14 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0