Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 12
    Well, that's what I didn't want to do, because it will take a long time... Thanks anyway. Commented Mar 22, 2011 at 17:45
  • 15
    Presumably mv is faster because you're on the same filesystem? What if you use cp -l to create hardlinks rather than actually moving the files? Commented Mar 22, 2011 at 20:32
  • 8
    You should use cp -a instead of cp -r in order to preserve the file attributes (timestamp, permissions, etc.). Commented Feb 2, 2014 at 7:14
  • 9
    For people arriving here late via google, the answer below by @palswim emulates the behavior of mv by creating new hard links to the data and then deleting the old links. Short answer cp -rl source destination && rm -r source. Commented May 31, 2016 at 17:43
  • 5
    Always BE CAREFUL when using rm -rf, be sure to specify the folder name at the end and to not use variables if you are in script, you might end up running rm -rf / and this will "kind" break your server. Commented Jul 7, 2021 at 14:24