added -p flag to cp, mv to create intermediate dirs as needed