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

mc ls/cp --recursive source dest get unexpected files #4722

Closed
fbs2016 opened this issue Oct 18, 2023 · 5 comments
Closed

mc ls/cp --recursive source dest get unexpected files #4722

fbs2016 opened this issue Oct 18, 2023 · 5 comments

Comments

@fbs2016
Copy link

fbs2016 commented Oct 18, 2023

Expected behavior

Take cp command as example, cp one file(testFile) only.

Actual behavior

copy 2 files testFile and testFile1.

Steps to reproduce the behavior

In source path, it includes 2 files, testFile and testFile1.
mc cp --recursive ./testFile $destpath
It copy testFile and testFile1 like copy testFile*.

mc --version

  • (paste output of mc --version)
    mc --version
    mc version DEVELOPMENT.GOGET (commit-id=DEVELOPMENT.GOGET)
    Runtime: go1.21.1 linux/amd64
    Copyright (c) 2015-0000 MinIO, Inc.
    License GNU AGPLv3 https://www.gnu.org/licenses/agpl-3.0.html

System information

@harshavardhana
Copy link
Member

That is expected behavior, its called prefix match.

@fbs2016
Copy link
Author

fbs2016 commented Oct 19, 2023

@harshavardhana Thanks. I know the option "--recursive" is target to folder copy only.
For the folder copy case, source folder testFoder and testFolder1, mc cp --recursive testFolder destPath, it also copy testFolder and testFoder1. And how to run the command if I just want to copy testFoder only? Thanks

And it's diff with linux ls/cp command, "-r" will not call the prefix match, prefix* can do this match.

@harshavardhana
Copy link
Member

just add / at the end if you want cp to terminate at testFolder -> mc cp -r testFolder/ destPath/

@fbs2016
Copy link
Author

fbs2016 commented Oct 20, 2023

@harshavardhana Thanks add / as testFolder/, it just copy all files in testFolder like testFolder/* and the output is destPath/filesIntestFolder not I want. I want copy the folder with path to destPath like destPath/testFolder as result.

@harshavardhana
Copy link
Member

@harshavardhana Thanks add / as testFolder/, it just copy all files in testFolder like testFolder/* and the output is destPath/filesIntestFolder not I want. I want copy the folder with path to destPath like destPath/testFolder as result.

Then do mc mirror

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

2 participants