casey/intermodal

How to exclude file or directory?

Opened this issue · 6 comments

The same issue from me: #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

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'.

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.

What's the error?

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.

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?

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