-1

I would like to be able to do this

mv /long/path/to/file/old.txt /long/path/to/file/new.txt

without typing the directory twice. I imagine something like

rename /long/path/to/file/old.txt new.txt

Is this possible?

1 Answers1

2

You can do it with brace expansion:

mv /long/path/to/file/{old,new}.txt
bxm
  • 4,855
  • 1
    The fun thing about brace expansion is that it's generative, rather than matching, so you can generate paths that don't exist yet. – stolenmoment Nov 24 '19 at 15:18