diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 7e2095dd1..db34ed872 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1481,13 +1481,18 @@ def move_items(lib, dest, query, copy, album, pretend, export=False, for obj in objs]) else: if export: + if album: for obj in objs: for item in obj.items(): + # Create necessary ancestry for the copy. + util.mkdirall(item.destination(basedir=dest)) util.copy(item.path, item.destination(basedir=dest)) else: - for item in objs: - util.copy(item.path, item.destination(basedir=dest)) + for obj in objs: + # Create necessary ancestry for the copy. + util.mkdirall(obj.destination(basedir=dest)) + util.copy(obj.path, obj.destination(basedir=dest)) if confirm: objs = ui.input_select_objects( u'Really %s' % act, objs, diff --git a/test/test_ui.py b/test/test_ui.py index 0f5ad5d67..33266d379 100644 --- a/test/test_ui.py +++ b/test/test_ui.py @@ -543,6 +543,8 @@ class ExportTest(_common.TestCase): self.assertExists(self.i.path) self.assertExists(self.itempath) + + def test_pretend_move_item(self): self._move(dest=self.otherdir, pretend=True) self.i.load()