-
-
Save genki/d658cb216939ba89f212c7413ede4cd0 to your computer and use it in GitHub Desktop.
mr: Move files relatively
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
opts, files = ARGV.partition {|a| a =~ /^-/} | |
first, *middle, last = files | |
base = File.expand_path File.dirname(first) | |
to = File.expand_path File.join base, last | |
system ['mv', *opts, first, *middle, to].join ' ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment