mc icon indicating copy to clipboard operation
mc copied to clipboard

mc mirror --exclude seems not to be working on windows

Open CrashLaker opened this issue 3 years ago • 5 comments

Expected behavior

excluding folder when uploading actually idk if it's actually only listing then excluding or both

Actual behavior

not excluding

Steps to reproduce the behavior

C:\Users\User>mc.exe mirror --exclude "AppData\*"  . windows-pc/backup/
 0 B / ? [                                                                                                           =]
mc.exe: <ERROR> Failed to perform mirroring Insufficient permissions to access this file `C:\Users\User\AppData\Local\ElevatedDiagnostics`

mc --version

  • (paste output of mc --version) mc version RELEASE.2022-05-04T06-07-55Z

System information

windows 10

CrashLaker avatar May 08 '22 21:05 CrashLaker

It looks like you and I are attempting to do the same thing, which is exclude using a prefix. See example 9 in the help:

  09. Mirror a bucket from aliased Amazon S3 cloud storage to a local folder.
      Exclude all .* files and *.temp files when mirroring.
      mc mirror --exclude ".*" --exclude "*.temp" s3/test ~/test

This makes me believe that --exclude is operating on the "filename" portion of the path, but the docs are unclear, in my opinion. I did some testing on my own and found that when I changed the filter to something that occurred in the filename, the object was excluded, so I believe that prefix-based exclusion is not the point of this flag. I'd love for there to be something like a --exclude-prefix, that would be super helpful.

henxing avatar Jul 14 '22 14:07 henxing

Is there any update on this? Seems the --exclude only works on files however when backing up some python projects I want to exclude all the directories that are not needed such as .git and pycache and the exclude commands doesn't work on folders

This command doesn't filter any of the folders

mc mirror --exclude ".*" --exclude "venv" --exclude "*pycache*" --exclude "*-info" "E:\Python Projects" s3/work_backup

MC Version: mc version RELEASE.2022-08-23T05-45-20Z (commit-id=07fffc3bc88f70a73c3714d9af23122f611b76cf) Runtime: go1.18.5 windows/amd64 Copyright (c) 2015-2022 MinIO, Inc. License GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>

thebetauser avatar Aug 23 '22 15:08 thebetauser

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 23 '22 03:11 stale[bot]

I can confirm this is still an issue. I'm unable to specify a directory to exclude using either the dir or dir/* syntax.

First mirror of the directory excluding tmp

exclude tmp from mirror

Then I removed tmp recursively to ensure it didn't exist, then tried again with --exclude tmp/*

exclude tmp/* from mirror

cwinters8 avatar Jan 10 '24 13:01 cwinters8

Further experimentation seems to reveal --exclude is not functional with file names or specific paths to files either

exclude hello.txt from mirror

Also tried removing --remove and enclosing the path in quotes just in case those might be factors, but saw the same behavior

exclude tmp/hello.txt using quotes

FWIW I think the ability to parse an ignore file would be the most useful for excluding files. For example if .mcignore exists in the source, exclude all matching files using the same rules as git follows for .gitignore.

mc version:

mc version RELEASE.2024-01-05T05-04-32Z (commit-id=59eca9fea8984adec1e8e7a1c95d0ea23107ceff)
Runtime: go1.21.5 darwin/amd64
Copyright (c) 2015-2024 MinIO, Inc.
License GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>

cwinters8 avatar Jan 10 '24 13:01 cwinters8

fix via #4825

jiuker avatar Mar 11 '24 03:03 jiuker