cp — copy a file
Attribute | Pos. | Req. | Default | Description |
---|---|---|---|---|
from | Yes | Yes | Source file to copy. | |
to | Yes | Yes | Destination directory or file to copy to. | |
umask | Interchange process default | File umask. | ||
preserve_times | 0 | Whether to preserve file access and modification times. | ||
interpolate | 0 | interpolate output? | ||
hide | 0 | Hide the tag return value? |
Example: Basic example
[either] [cp from=pages/index.html to=/tmp/ hide=1] [or] Copy failed. See error logs for details. [/either]
Interchange 5.9.0:
Source: code/UI_Tag/cp.coretag
Lines: 42
# Copyright 2002-2007 Interchange Development Group and others # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. See the LICENSE file for details. # # $Id: cp.coretag,v 1.5 2007-03-30 23:40:54 pajamian Exp $ UserTag cp Order from to UserTag cp addAttr UserTag cp Version $Revision: 1.5 $ UserTag cp Routine <<EOR require File::Copy; sub { my ($from, $to, $opt) = @_; #Debug("cp from=$from to=$to umask=$opt->{umask}"); my $save_mask; if($opt->{umask}) { $opt->{umask} = oct($opt->{umask}); $save_mask = umask($opt->{umask}); } my $status = File::Copy::copy($from, $to); if ($opt->{preserve_times}) { my ($atime, $mtime); ($atime, $mtime) = (stat $from)[8,9]; if ($atime) { $status = utime($atime, $mtime, $from); } else { $status = 0; } } umask($save_mask) if defined $save_mask; return '' if $opt->{hide}; return $status; } EOR