I’m using Rails 5. How do I get the full path of the destination file after copying a file? I’m currently doing this
FileUtils.cp(file_path, dest_dir)
Unfortunately the result of this call is nil. Is there a call that will tell me the full destination path or something else I can do to get this destination path in a variable?
FileUtils
is a stdlib in Ruby. If I understood correctly, what you're trying to do is get the pathname for the file you copied.You can try this, with Rails, where
dest_dir
is a path: