casey / intermodal

A command-line utility for BitTorrent torrent file creation, verification, and more
https://imdl.io
Creative Commons Zero v1.0 Universal
487 stars 25 forks source link

How to exclude file or directory? #538

Open once375ml opened 6 months ago

once375ml commented 6 months ago

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/tempdirs/imdl/omv.torrent -g ! /volume1/iso/OMV/openmediavault_6.0.24-amd64.iso_

casey commented 6 months ago

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

once375ml commented 6 months ago

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.

casey commented 6 months ago

What's the error?

once375ml commented 6 months ago

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.

casey commented 5 months ago

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?

neckothy commented 2 days ago

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.