Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copyTo function from a dir to a dir empties the target dir when overwrite is true #77

Closed
JakubKahovec opened this issue May 17, 2016 · 3 comments · Fixed by #164
Closed
Labels

Comments

@JakubKahovec
Copy link

Hi,

I've found out that when I'm calling copyTo from a dir to a target dir it empties the target dir, which seems to me pretty odd behaviour. Normally when one copies files from a source dir to a target dir doesn't expect that the target dir gets erased.

Jakub

@jiminhsieh
Copy link
Contributor

I found when using copyTo with overwrite = true, it would simply delete anything in the target directory. If I am correct, I would try to work on this. Thanks!

jiminhsieh added a commit to jiminhsieh/better-files that referenced this issue Jul 14, 2017
@jiminhsieh jiminhsieh mentioned this issue Jul 14, 2017
Merged
@poslegm
Copy link
Contributor

poslegm commented Aug 6, 2017

I think that if (overwrite) destination.delete(swallowIOExceptions = true) in File.copyTo is useless because files in target dir will be overwrited by File.CopyOptions(overwrite).

File.copyTo without this line works like a UNIX cp util.

pathikrit added a commit that referenced this issue Aug 7, 2017
#77 - overwriting bug and #44 - better unix compability for cp and mv
@pathikrit
Copy link
Owner

Fixed in #168

pathikrit added a commit that referenced this issue Aug 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants