Say my files on a Ubuntu server are like: /folder1/folder2/
I am in folder1
currently, and I want to move all files/folders (recursive) from folder2
to the current folder.
How can I do this?
there is a caveat to be aware of if you have invisible files (starting with '.') in your folder. dotglob (*) won't expand (and mv won't move) invisible files unless you change it's behaviour with shopt
. shopt -s dotglob
to expand invisible files and shopt -u dotglob
to switch back to default.
recursively move files to current folder:
find -type f -exec mv -v {} . \;
be aware that you won't be overwriting existing files.