Why not "mv -r" in Linux bash? [closed]
Matthew Martinez
Well, I know you have to use -r with cp and rm when dealing with directories. It makes this job recursively (meaning it coping and removing all starting with things inside). But why you dont do "mv -r" when moving / renaming directories?
12 Answers
Directories are just collections of pointers to locations of files on the filesystem. When you move a directory you are updating the file pointers of the new and old parents to contain/remove the one you moved. Thus, child file pointers inside do not require recursive action as none of the pointer locations have actually changed for them.
EDIT: I've just found a much more detailed answer on Unix & Linux StackExchange that will help explain this further.
For every move, new location is needed. If one wants to move all files under directory alongwith the directory, just move the directory which is recursive.
1