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

file already exists #17

Open
dy opened this issue Jan 30, 2019 · 6 comments
Open

file already exists #17

dy opened this issue Jan 30, 2019 · 6 comments

Comments

@dy
Copy link

dy commented Jan 30, 2019

We have .env and .env.development files in the C:\projects\xxx\.
Running cpy gives:

$ npx cpy './.env.development' './.env'
Cannot copy from `C:\projects\xxx\.env.development` to `C:\projects\xxx\.env\.env.development`: Cannot create directory `C:\projects\xxx\.env`: EEXIST: file already exists, mkdir 'C:\projects\xxx\.env'

Is that the expected result? Is there a workaround?
@sindresorhus

@revelt
Copy link

revelt commented Feb 7, 2019

Wait, but you said .env is a file, then why is it put as a destination, ./.env, the second argument above?

To me it looks like you're putting two source files and incorrectly assuming second will be a destination.

If you really had two dot files, you could use globs. For example, if both files are in current directory, then try:

npx cpy ".*" "c:\projects\secret_folder"

or do one-by-one...

Please update how it went. And please correct me if I misunderstood the question. Cheers

@dy
Copy link
Author

dy commented Feb 7, 2019

@revelt I just expected the way cp works, so I used shx for that:

shx cp ./.env.development ./.env

Not sure what trouple cpy makes of files named .env.sfx

@revelt
Copy link

revelt commented Feb 7, 2019

I see... Do you think we can solve this or are you happy with shx? I'm a user of this cli myself and one-to-one file copying works fine. But API can always be improved, it's just we have to draw up a persuasive case first. What do you think @dy ?

@dy
Copy link
Author

dy commented Feb 7, 2019

That seems to be an issue of related cpy and other packages. Needs resolution.
I'd rather set a tip to @sindresorhus for fixing that case, that'd be faster.
So far I'm fine with shx

@sindresorhus
Copy link
Owner

Yeah, that's a bug in cpy. It should allow the the destination to be a file if the source is just one file and the destination doesn't already exist as a directory.

@dsumac
Copy link

dsumac commented Jul 19, 2023

Hello
Is there any news about this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants