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*

5
  • 2
    \$\begingroup\$ Rename the files. No need to "take the contents" and swap them to achieve the result. \$\endgroup\$ Commented Dec 28, 2013 at 19:32
  • \$\begingroup\$ @Darren Stone I think that should be illegal. Thanks for catching that before answers were submitted. \$\endgroup\$ Commented Dec 28, 2013 at 19:33
  • \$\begingroup\$ Looks like a bad constraint, renaming is the best way to do this \$\endgroup\$ Commented Dec 28, 2013 at 20:47
  • 1
    \$\begingroup\$ Alright, I can remove this constraint. \$\endgroup\$ Commented Dec 28, 2013 at 20:55
  • 11
    \$\begingroup\$ @hdante but 'renaming files' is not exchanging their contents. On a system that uses inodes the goal here would be for i.txt's inode to contain the data from o.txt's inode, and vice versa, so that if there are hardlinks to those inodes elsewhere, their contents will appear swapped as well. Renaming can't accomplish that. \$\endgroup\$ Commented May 11, 2014 at 3:07