[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Moving Files



At 08:46 -0700 98/10/07, ldtelgar@realitybytes.net wrote:
>
> I cant seem to think right now, and the anser is most likly right infront
>of my
> face, but at any rate... I would like to move a file from one directory
>to
> another with Perl, but I am not that clear on how to do this with the Mac
> directory structure.

Start with rename.  Note that rename doesn't work across filesystems
(volumes) so if you need to do that you'll need to do a copy and then an
unlink (removal).

Use File::Copy for copying files.

Mac pathnames - see the discussion in MacPerl: Power and Ease, chapter 7,
starting on p. 100.  If you don't have the book (you should have the book
:-) take a look at the HTML version posted on the web pages; follow the
link under http://www.ptf.com/macperl/ptf_book

We included a MacPerl droplet called path2clip on the CD included with
MacPerl: Power and Ease.  Drop a file on it and it puts the full pathname
of that file on the clipboard, ready to paste into a script or anywhere
else.  (This droplet uses the Dartmouth Clipboard XFCN). Other solutions
are available; there are shareware Applescript droplets, for example
DropPath, that do the same thing. Get Info also shows the full path but you
have to type it in rather than have the convenience of pasting.
---
Vicki Brown, vlb@cfcl.com        |\      _,,,---,,_
Journeyman Sourceror      ZZZzz /,`.-'`'    -.  ;-;;,_
Scripts & Philtres             |,4-  ) )-,_. ,\ (  `'-'
http://www.cfcl.com/~vlb      '---''(_/--'  `-'\_)
P.O. Box 1269 San Bruno, CA  94066

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch