To understand how it move folders you may need to understand a bit about file system under linux. Every files and folders are stored as part of a data structure called an "inode". Each file has an inode number, so does folders.
To view the inode of your folder, use the command ls -ial foldername
. The first column shows the inode number of the file. For each folder there are two unique names .
and ..
, representing the directory of its own, and the parent directory respectively.
You can try doing an experiment to move a directory (say, /home/me/source) with sub-directories and files to another directory (e.g. /home/me/somewhere/else). The inode number of /home/me/source and all its contents remains the same before and after moving. The only difference is the inode number of ..
, which originally shares the inode number of /home/me and now becomes the inode number of /home/me/somewhere/else. In simple wording, Linux update the link to directory source and then it's done.
The contents on the hard disk are not modified anyway, only the inode index is updated when the folder is moved. This is, of course, not the case if you move the folder to a different physical location.