If destinationFolder is /home/user/Desktop/Destination and source and dir (at least for the first recursive call) are /home/user/Desktop/ToBeCopied.
The result of destinationFolder will be /home/user/Desktop/Destination. This works fine and it is supercool however I cannot see why it gives back this outcome since source.relativize(dir); returns ../ToBeCopied and then with destinationFolder.resolve(../ToBeCopied) it should return (without normalizing it) /home/user/Desktop/Destination/../ToBeCopied hence /home/user/Desktop/ToBeCopied. Now if it was the case my program would not work, /ToBeCopied would self copy itself (if it makes sense). What actually happens is that in somehow the system takes the relative pattern used in source.relativize(dir) which is ../ToBeCopied and read something like "go back one step and then comeback" not like "go back one step and then back to /ToBeCopied". Why does it happen though? Logically should give back /home/user/Desktop/Destination/../ToBeCopied instead it returns /home/user/Desktop/Destination. What am I missing? Thanks a lot in advance!
PS: dir is the current directory of the recursive method preVisitDirectory and the first call will be exactly the same as the source itself.