file1 = "my'crazy'file.txt"
file2 = 'my"crazy"file.txt'
system "mv \"#{file2}\" bettername.txt" # fails on file2
system "mv '#{file2}' bettername.txt" # fails on file1
The answer is to use the multiple arguments invocation, which will properly escape your filename to be fully shell compatible:
system "mv", file1, "bettername.txt" # works on file1 or file2