Linux command to move a directory Linux command to move a directory linux linux

Linux command to move a directory


You should use mv -if old/* new/ without the trailing *.

This is because it unrolled to

mv -if old/foo old/bar old/baz new/foo new/bar new/baz

i.e. move everything into new/baz

This is not what you wanted.


reef@localhost:/tmp/experiment$ ls a11  22  33reef@localhost:/tmp/experiment$ ls b22  33reef@localhost:/tmp/experiment$ lsa  breef@localhost:/tmp/experiment$ mv a/* breef@localhost:/tmp/experiment$ ls areef@localhost:/tmp/experiment$ ls b11  22  33

It works. What are You trying to achieve? Could You please write a short example of what the input data should look like and what the output data should look like? The truth is I have no idea what You are trying to do :) Help me help You.


note that mv a/* b/ don't move files .* (file name start with '.') in a/ to b/

ex:

$ mkdir -p a/d b && touch a/f a/.f a/d/.f$ mv a/* b/$ ls -a a/.  ..  .f