Dan Kogai > MacOSX-File > pcpmac

Download:
MacOSX-File-0.71.tar.gz

Annotate this POD

CPAN RT

New  6
Open  1
View/Report Bugs
Source  

NAME ^

pcpmac -- CpMac(1) or cp(1), implemented as perl script

SYNOPSIS ^

 pcpmac [-r] [-f|-i] [-p][-v] source_file target_file
 pcpmac [-r] [-f|-i] [-p][-v] source_file ... target_directory

TIGER ^

As of Mac OS X v10.4 (Tiger), the ordinary cp(1) does support resource fork.

DESCRIPTION ^

pcpmac, as its name implies, copies files with finder info and resource fork.

In the first synopsis form, pcpmac copies the contents of the source_file to the target_file. In the second synopsis form, the contents of each named source_file is copied to the destination target_directory. The names of the files themselves are not changed. If cpmac detects an attempt to copy a file to itself, the copy will fail.

The following options are available:

-r

If source_file designates a directory, cp copies the directory and the entire subtree connected at that point.

-f

Foreach existing destination pathname, attempt to overwrite it. If permissions do not allow copy to succeed, remove it and create a new file, without prompting for confirmation.

-i

Causes pcpmac to write a prompt to the standard error output before copying a file that would overwrite an existing file. If the response from the standard input begins with the character "y" or "Y", the file copy is attempted.

For safety, this option cancels -f option. This is the opposite of BSD cp implementation.

-p

Causes cp to preserve in the copy as many of the modification time, access time, file flags, file mode, user ID, and group ID as allowed by permissions.

Note that no symlinks are followed. Instead the target will also be symlink which points to the same path. With this respect, This option corresponds to cp -PR of BSD cp.

pcpmac also prevents from crossing devices when subtrees belong to different volumes. That way you can safely pcpmac /* /Volumes/backup without hanging yourself. This is anologous to -x(dev) option of find command but somehow nothing like that existed for cp so I made it.

pcpmac also goes one step forward when both of two arguments are same directory. Compare cp -r dir1 dir1 and pcpmac dir1 dir1 where dir1 are identical. It is a kind of fun what cp does!

-v

Verbose mode. Prints each copied item to standard output.

AUTHOR ^

Dan Kogai <dankogai@dan.co.jp>

SEE ALSO ^

cp(1)

/Developer/Tools/CpMac

COPYRIGHT ^

Copyright 2002-2005 Dan Kogai <dankogai@dan.co.jp>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: