Skip to content

Instantly share code, notes, and snippets.

@mariash
Created October 5, 2012 00:24
Show Gist options
  • Save mariash/3837319 to your computer and use it in GitHub Desktop.
Save mariash/3837319 to your computer and use it in GitHub Desktop.
FileUtils copy with preserve and symlink issue
# copy with preserve updates metadata of file and if file that symlink points to has not been copied yet it fails
require "fileutils"
`mkdir ./src`
`touch ./src/foo`
# Important that symlink name goes before source name in alphabetical order (bar points to foo)
`ln -s ./src/foo bar`
# Copy fails - No such file or directory - ./dest/bar
FileUtils.cp_r("./src", "./dest", :preserve => true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment