question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dvc move path/to/some.tgz path/to/dir/

See original GitHub issue

👉 dvc 0.23.2 installed via pip on ubuntu

dvc move path/to/some.tgz path/to/dir/ did something rather strange and unintuitive when I tried to move a file to a destination directory (without re-specifying the destination filename).

I expected it to behave like unix’s mv, which moves a file into the destination directory while keeping the same name, when a directory (with trailing slash) is specified as the destination, e.g. mv thing.txt path/to/dir/ results in path/to/dir/thing.txt.

So I started with directory structure:

data/some.tgz
data/some.tgz.dvc
sub/data/

And I ran the command:

$ dvc move data/some.tgz sub/data/

I ended up with the directory structure:

data/.dvc
data/sub/data
sub/data/

… which looks kind of like the directory data/ is now under dvc control, and the some.tgz was renamed to data/sub/data (a file with no extension). du -sh data/sub shows that data/sub/data is of the same file size as the original .tgz.

What I expected to end up with:

data/
sub/data/some.tgz
sub/data/some.tgz.dvc

I think that there are at least a couple bugs here.

  1. It is clear in my syntax that I intended the destination to be a directory. dvc doesn’t seem to handle that syntax. It would be great if dvc could be updated to support this syntax — or, at the very least, to detect this syntax and give an error message to prevent the current behavior, which I can’t imagine is desired.
  2. Might be irrelevant if you fix the first bug, but it seems something weird is happening with the paths here. How did the destination path (sub/data/) get somehow combined with the src path (data/some.tgz) to produce data/sub/data? 🤔

I was able to get myself out of this miss by dvc move data/sub/data data/some.tgz, which resulted in:

data/data/some.tgz
data/.dvc

Then I renamed data/.dvc to data/data/some.tgz.dvc and updated its path property to some.tgz. Then, finally, I ran dvc move data/data/some.tgz ../../sub/data/some.tgz, which is still running now, but I think might get me where I wanted to go in the first place. 🤞

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
efiopcommented, Jan 24, 2019

@colllin 0.24.0 is out. Please feel free to upgrade 🙂

0reactions
efiopcommented, Jan 23, 2019

@colllin Sorry for the delay, we are preparing to release 0.24.0 with it this week. For now, you could try installing an upstream version with pip uninstall dvc && pip install git+https://github.com/iterative/dvc.

Read more comments on GitHub >

github_iconTop Results From Across the Web

move | Data Version Control - DVC
If the destination path is a directory and already exists, the source file or directory is moved into this folder along with the...
Read more >
dvc move fails to move datafile to a directory, when ... - GitHub
I was playing with dvc move and I got this problem. Script to reproduce it: #!/bin/bash -x rm -rf test1 mkdir test1 cd...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found