From: darren kirby Date: 2006-08-24T08:25:34+09:00 Subject: Moving files with ruby... --nextPart1200391.Mms6yP9lv3 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello all, A script I have written needs the ability to move files. I thought I would = be=20 clever and use File.rename(old, newdir + new) but this is giving me an erro= r:=20 `rename': Invalid cross-device link. I gather this is because I am renaming= =20 the file to a different partition. So then I found FileUtils and used: require 'fileutils' include FileUtils mv( old, new) This is working but seems an overly verbose and convoluted way to move a fi= le.=20 I had a look at the fileutils.rb source and found this (for 'mv'): # Moves file(s) +src+ to +dest+. If +file+ and +dest+ exist on the differe= nt # disk partition, the file is copied instead =20 So I guess my real question is: is there a technical reason or some arbitra= ry=20 reason there is no File.move() method that can handle this transparently? I= =20 would think it would be quite useful... Any insight is appreciated, =2Dd =2D-=20 darren kirby :: Part of the problem since 1976 :: http://badcomputer.org "...the number of UNIX installations has grown to 10, with more expected..." =2D Dennis Ritchie and Ken Thompson, June 1972 --nextPart1200391.Mms6yP9lv3 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQBE7OPowPD5Cr/3CJgRAhUCAJ9l96iPulTADd6DVxuYHP3/eYxCPwCeNkl7 +lUriMRAgr5tCBSE48bxZ5U= =PUtC -----END PGP SIGNATURE----- --nextPart1200391.Mms6yP9lv3--