rename_a_file.sf 293 B

1234567891011121314
  1. #!/usr/bin/ruby
  2. #
  3. ## https://rosettacode.org/wiki/Rename_a_file
  4. #
  5. # Here
  6. File.rename('input.txt', 'output.txt');
  7. File.rename('docs', 'mydocs');
  8.  
  9. # Root dir
  10. File.rename(Dir.root + %f'input.txt', Dir.root + %f'output.txt');
  11. File.rename(Dir.root + %f'docs', Dir.root + %f'mydocs');