names path split('/')[ :node root for name in namesnode node children[namereturn node we've created the move and delete methods on the component class both of them access mysterious parent variable that we haven' set yet the move method uses module-level get_path function that finds node from predefined root nodegiven path all files will be added to this root node or child of that node for the move methodthe target should be currently existing folderor we'll get an error as with many of the examples in technical bookserror handling is woefully absentto help focus on the principles under consideration let' set up that mysterious parent variable firstthis happensin the folder' add_child methoddef add_child(selfchild)child parent self self children[child namechild wellthat was easy enough let' see if our composite file hierarchy is working properlypython - _add_child py folder folder('folder 'folder folder('folder 'root add_child(folder root add_child(folder folder folder('folder 'folder add_child(folder file file('file ''contents'folder add_child(file file file('file ''other contents'folder add_child(file folder children {'file 'folder move('/folder /folder 'folder children {'folder ''file '<__main__ file object at xb ec>