rewrite in the style of remote_directory