Home » Questions » Computers [ Ask a new question ]

Where did my directory go after "mv parentdir/mydir ../mydir"?

Where did my directory go after "mv parentdir/mydir ../mydir"?

I thought I was moving a sub directory up a level so that it would be a sibling of its parent. But it's now completely invisible. Is it gone?

Asked by: Guest | Views: 47
Total answers/comments: 2
Guest [Entry]

I figured it out. All I did was change the name so that it started with the .., and that made it hidden to the "ls" command.
Guest [Entry]

"When running a command like cp, scp, mv and the like, where the second argument is a directory, it's safest to end it with a /., so that both you and the command know that you are looking for a directory there. For example, instead of doing this:

$ mv /opt/foo /temp

I would do:

$ mv /opt/foo /temp/.

and get the error message:

mv: cannot move `/opt/foo' to `/temp/.': No such file or directory

because, of course, I meant to type /tmp/.. Had I run the first command I would have silently -- and quite unintentionally -- renamed the directory."