Method: FileUtils.symlink
- Defined in:
- lib/extensions/fileutils/fileutils.rb
.symlink ⇒ Object
Options: force noop verbose
ln_s(old, new, options = {})
Creates a symbolic link new which points to old. If new already exists and it is a directory, creates a symbolic link new/old. If new already exists and it is not a directory, raises Errno::EEXIST. But if :force option is set, overwrite new.
FileUtils.ln_s '/usr/bin/ruby', '/usr/local/bin/ruby'
FileUtils.ln_s 'verylongsourcefilename.c', 'c', :force => true
ln_s(list, destdir, options = {})
Creates several symbolic links in a directory, with each one pointing to the item in list. If destdir is not a directory, raises Errno::ENOTDIR.
If destdir is not a directory, raises Errno::ENOTDIR.
FileUtils.ln_s Dir.glob('bin/*.rb'), '/home/aamine/bin'
352 353 354 355 356 357 358 359 360 |
# File 'lib/extensions/fileutils/fileutils.rb', line 352 def ln_s(src, dest, = {}) , OPT_TABLE['ln_s'] "ln -s#{options[:force] ? 'f' : ''} #{[src,dest].flatten.join ' '}" if [:verbose] return if [:noop] fu_each_src_dest0(src, dest) do |s,d| remove_file d, true if [:force] File.symlink s, d end end |