method
syscopy
ruby latest stable - Class:
File
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v1_8_7_330) is shown here.
syscopy(from, to)public
Copies a file from to to. If to is a directory, copies from to to/from.
# File lib/ftools.rb, line 56
def syscopy(from, to)
to = catname(from, to)
fmode = stat(from).mode
tpath = to
not_exist = !exist?(tpath)
from = open(from, "rb")
to = open(to, "wb")
begin
while true
to.syswrite from.sysread(BUFSIZE)
end
rescue EOFError
ret = true
rescue
ret = false
ensure
to.close
from.close
end
chmod(fmode, tpath) if not_exist
ret
end Related methods
- Instance methods
- atime
- chmod
- chown
- ctime
- flock
- lstat
- mtime
- o_chmod
- path
- truncate
- Class methods
- atime
- basename
- blockdev?
- catname
- chardev?
- chmod
- chmod
- chown
- compare
- copy
- ctime
- delete
- directory?
- dirname
- executable?
- executable_real?
- exist?
- exists?
- expand_path
- extname
- file?
- fnmatch
- fnmatch?
- ftype
- grpowned?
- identical?
- install
- join
- lchmod
- lchown
- link
- lstat
- makedirs
- move
- mtime
- new
- owned?
- pipe?
- readable?
- readable_real?
- readlink
- rename
- safe_unlink
- setgid?
- setuid?
- size
- size?
- socket?
- split
- stat
- sticky?
- symlink
- symlink?
- syscopy
- truncate
- umask
- unlink
- utime
- writable?
- writable_real?
- zero?