I’m a beginner in ruby and in programming as well and need help with system call for moving a file from source to destination like this:
system(mv "#{@SOURCE_DIR}/#{my_file} #{@DEST_DIR}/#{file}")
Is it possible to do this in Ruby? If so, what is the correct syntax?
system("mv #{@SOURCE_DIR}/#{my_file} #{@DEST_DIR}/#{file})can be replaced with
system("mv", "#{@SOURCE_DIR}/#{my_file}", "#{@DEST_DIR}/#{file}")which reduces the chances of a command line injection attack.