intermodal icon indicating copy to clipboard operation
intermodal copied to clipboard

How to exclude file or directory?

Open once375ml opened this issue 1 year ago • 6 comments

The same issue from me: https://github.com/casey/intermodal/issues/536

I need command instruction. If I remove the space between "!" and path, it reports error.

Here are the command and screenshot: /volume1/temp_dirs/imdl/imdl torrent create -S -P -p 4mib -a https://xyz.io/announce.php -i /volume1/iso/OMV -o /volume1/temp_dirs/imdl/omv.torrent -g ! /volume1/iso/OMV/openmediavault_6.0.24-amd64.iso

once375ml avatar May 17 '24 08:05 once375ml

I think the issue is that ! is a special character in the shell. Try putting them together and quoting them: -g '!/volume1/iso/OMV/openmediavault_6.0.24-amd64.iso'.

casey avatar May 18 '24 23:05 casey

I think the issue is that ! is a special character in the shell. Try putting them together and quoting them: -g '!/volume1/iso/OMV/openmediavault_6.0.24-amd64.iso'.

Still the same.

once375ml avatar May 19 '24 01:05 once375ml

What's the error?

casey avatar May 19 '24 02:05 casey

What's the error?

I had excluded the openmediavault_6.0.24-amd64.iso with your command instruction. You will see the exact command I input at the top of the screenshot. But it produced the same torrent like I didn't exclude any file. You will also see the openmediavault_6.0.24-amd64.iso is in the torrent at the bottom of the screenshot.

once375ml avatar May 19 '24 13:05 once375ml

Hmmm, I honestly don't remember how exclusion patterns work. Does a relative path work, either -g! OMV/openmediavault_6.0.24-amd64.iso or -g!openmediavault_6.0.24-amd64.iso?

casey avatar May 20 '24 08:05 casey

I think the exclusion pattern is relative to the input, so in this case should be -g '!openmediavault_6.0.24-amd64.iso'

e.g. imdl torrent create -i test -g '!file2' excludes test/file2 while including test/file1 in testing.

On a related note, the exclusion examples in the FAQ were a bit confusing for me. It seemingly shows excluding directories as -g '!bar/', which I couldn't get to work in testing. After some trial and error, I realized using a wildcard accomplishes what I wanted. This makes sense with globbing, but it tripped me up when closely following the FAQ example (which I thought applied almost identically to my needs.)

e.g.

  • imdl torrent create -i test -g '!dir2/*' excludes test/dir2 and all of its files, while including test/dir1.
  • imdl torrent create -i test -g '!dir2/' doesn't exclude test/dir2
  • imdl torrent create -i test -g '!dir2' doesn't exclude test/dir2

ghost avatar Nov 12 '24 18:11 ghost