73
32
Is there a clever way to do copy and move operations or a command to duplicate a file, without having to do a cd
, then mv
after, at the same folder?
For example, I have to run the following:
mv /folder1/folder2/folder3/file.txt /folder1/folder2/folder3/file-2013.txt
Note that the directory to where I'm moving the file is the same, but I have to put the whole path again and sometimes it gets annoying. I'm curious to know if there's another way to do that without having to put the whole path again, because the operation would be done in the same path.
9
I can't believe this has so many upvotes. It's a duplicate http://unix.stackexchange.com/questions/35782/quick-way-to-include-a-directory-path-when-calling-mv and http://unix.stackexchange.com/questions/66889/minimal-command-to-make-a-copy-of-a-file
– user13107 – 2013-05-17T16:28:29.09713@user13107 There are many ways to ask a question, including different wording. And if you don't know that the answer is called "brace expansion", you might not be able to find it right away. – slhck – 2013-05-17T16:37:31.683
2@user13107 they are on a different site so not duplicates – user151019 – 2013-05-18T07:13:53.000
1Mark, Thanks, I didn't know that rule about duplicates. @slhck Yes. I understand. I was just frustrated because my question on Unix.SE got closed as duplicate and this one got so popular. – user13107 – 2013-05-18T08:24:54.793
3@user13107, that's what you get for posting on the right site – Samuel Edwin Ward – 2013-05-18T14:08:23.560