lavv17 / lftp

sophisticated command line file transfer program (ftp, http, sftp, fish, torrent)
http://lftp.yar.ru
GNU General Public License v3.0
1.11k stars 162 forks source link

`mirror -c -P 32 wp-*` wildcard usage? #714

Open 0x42h opened 1 year ago

0x42h commented 1 year ago

Is it just me, or should this expectation be pretty straightforward?

> ls -lah wp-*
-rw-r--r--   1 <username> <group>     7.0k Oct  2 22:05 wp-activate.php
drwxr-xr-x   9 <username> <group>     8.0k Oct  2 22:04 wp-admin
-rw-r--r--   1 <username> <group>      351 Oct  2 22:05 wp-blog-header.php
-rw-r--r--   1 <username> <group>     2.3k Oct  2 22:05 wp-comments-post.php
-rw-r--r--   1 <username> <group>     3.8k Oct  2 22:01 wp-config.php
-rw-r--r--   1 <username> <group>     2.9k Oct  2 22:00 wp-config-sample.php
drwxr-xr-x  23 <username> <group>     4.0k Oct  5 12:01 wp-content
-rw-r--r--   1 <username> <group>     5.5k Oct  2 22:05 wp-cron.php
drwxr-xr-x  27 <username> <group>    20.0k Oct  2 22:01 wp-includes
-rw-r--r--   1 <username> <group>     2.4k Oct  2 22:05 wp-links-opml.php
-rw-r--r--   1 <username> <group>     3.8k Oct  2 22:05 wp-load.php
-rw-r--r--   1 <username> <group>    48.3k Oct  2 22:05 wp-login.php
-rw-r--r--   1 <username> <group>     8.3k Oct  2 22:05 wp-mail.php
-rw-r--r--   1 <username> <group>    25.0k Oct  2 22:05 wp-settings.php
-rw-r--r--   1 <username> <group>    33.6k Oct  2 22:05 wp-signup.php
-rw-r--r--   1 <username> <group>     4.8k Oct  2 22:05 wp-trackback.php
> mirror -c -P 32 wp-*
mirror: Access failed: 550 /private_html/wp-*: No such file or directory
1 error detected

Expectation: all files and directories starting with wp- will be mirrored.

lavv17 commented 1 year ago

The mirror command expects a directory without wildcards. You should specify a filter using -I (--include-glob) option.

On Thu, 5 Oct 2023 at 15:06 0x42h @.***> wrote:

Is it just me, or should this expectation be pretty straightforward?

ls -lah wp-* -rw-r--r-- 1 7.0k Oct 2 22:05 wp-activate.php drwxr-xr-x 9 8.0k Oct 2 22:04 wp-admin -rw-r--r-- 1 351 Oct 2 22:05 wp-blog-header.php -rw-r--r-- 1 2.3k Oct 2 22:05 wp-comments-post.php -rw-r--r-- 1 3.8k Oct 2 22:01 wp-config.php -rw-r--r-- 1 2.9k Oct 2 22:00 wp-config-sample.php drwxr-xr-x 23 4.0k Oct 5 12:01 wp-content -rw-r--r-- 1 5.5k Oct 2 22:05 wp-cron.php drwxr-xr-x 27 20.0k Oct 2 22:01 wp-includes -rw-r--r-- 1 2.4k Oct 2 22:05 wp-links-opml.php -rw-r--r-- 1 3.8k Oct 2 22:05 wp-load.php -rw-r--r-- 1 48.3k Oct 2 22:05 wp-login.php -rw-r--r-- 1 8.3k Oct 2 22:05 wp-mail.php -rw-r--r-- 1 25.0k Oct 2 22:05 wp-settings.php -rw-r--r-- 1 33.6k Oct 2 22:05 wp-signup.php -rw-r--r-- 1 4.8k Oct 2 22:05 wp-trackback.php

mirror -c -P 32 wp- mirror: Access failed: 550 /private_html/wp-: No such file or directory 1 error detected

Expectation: all files and directories starting with wp- will be mirrored.

— Reply to this email directly, view it on GitHub https://github.com/lavv17/lftp/issues/714, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHLWXGYVWGMZIPCQHMEZKDX52PFNAVCNFSM6AAAAAA5UEUGJSVHI2DSMVQWIX3LMV43ASLTON2WKOZRHEZDQMJSGY4TQMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

0x42h commented 1 year ago

Hi @lavv17,

Thanks for your reply. All the following does not work as expected. I get way more than I ask for, given that obviously I'm using it wrong, in case there is some way to actually make this work, besides the point on how user-friendly it is:

> pwd
ftp://user@host/private_html
> mirror -P 32 -c --include-glob='/wp-*'

Gives me more than just wp-*.

> mirror -P 32 -c --include-glob='/private-html/wp-*'

Gives me more than just wp-*.

> mirror -P 32 -c --include='^/private-html/wp-.*'

Gives me more than just wp-*.

> mirror -P 32 -c --include='wp-'

Gives me more than just wp-*.

> mirror -P 32 -c --include='.*wp-.*'

Gives me more than just wp-*.

> mirror -P 32 -c --include-glob='*wp-*'

Gives me more than just wp-*.

It just feels totally counter-intuitive to me and I cannot seem to make it work. Neither can I find examples in the documentation on how to use it correctly.

lavv17 commented 1 year ago

Maybe the mget command will work better for you.

On Thu, 5 Oct 2023 at 16:07 0x42h @.***> wrote:

Hi @lavv17 https://github.com/lavv17,

Thanks for your reply. All the following does not work as expected. I get way more than I ask for, given that obviously I'm using it wrong, in case there is some way to actually make this work, besides the point on how user-friendly it is:

pwd @.**/private_html mirror -P 32 -c --include-glob='/wp-'

Gives me more than just wp-*.

mirror -P 32 -c --include-glob='/private-html/wp-*'

Gives me more than just wp-*.

mirror -P 32 -c --include='^/private-html/wp-.*'

Gives me more than just wp-*.

mirror -P 32 -c --include='wp-'

Gives me more than just wp-*.

mirror -P 32 -c --include='.wp-.'

Gives me more than just wp-*.

mirror -P 32 -c --include-glob='wp-'

Gives me more than just wp-*.

It just feels totally counter-intuitive to me and I cannot seem to make it work. Neither can I find examples in the documentation on how to use it correctly.

— Reply to this email directly, view it on GitHub https://github.com/lavv17/lftp/issues/714#issuecomment-1748864048, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHLWXAYY6CILM35XJDTWO3X52WI5AVCNFSM6AAAAAA5UEUGJSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBYHA3DIMBUHA . You are receiving this because you were mentioned.Message ID: @.***>

0x42h commented 1 year ago

mget is not recursive. It does not download directories.

0x42h commented 1 year ago

Interesting. I see that this works:

mirror --exclude '.*' --exclude '.*/' --include 'wp-*'

So first, I need to exclude everything and then include the things I want to include. I find it an "interesting" way of suggest to download the same as the command ls -la wp-* shows me.

Is it hard to implement. Want help, maybe? Or is the code not designed to easily implement this?