minio / mc

Unix like utilities for object store
https://min.io/download
GNU Affero General Public License v3.0
2.86k stars 548 forks source link

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

Closed fbs2016 closed 1 year ago

fbs2016 commented 1 year ago

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

System information

harshavardhana commented 1 year ago

That is expected behavior, its called prefix match.

fbs2016 commented 1 year ago

@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 commented 1 year ago

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

fbs2016 commented 1 year ago

@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 commented 1 year ago

@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