My old and new directory have same folders and files inside.
I try:
mv -if old/* new/*
and get error
mv: cannot move `./xxxxxx' to a subdirectory of itself
How can I move it?
Select the directory you want to move and press Ctrl+X. Alternatively, right-click the directory and select Cut from the drop-down menu. 2. Navigate to the destination and press Ctrl+V or right-click the empty space and select Paste from the drop-down menu to move the directory.
The mv command moves files and directories from one directory to another or renames a file or directory. If you move a file or directory to a new directory, it retains the base file name. When you move a file, all links to other files remain intact, except when you move it to a different file system.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With