SQLite Forum

sqlar : how to remove files
Login
> Is this by design

It's by *mis-design,* but the error is in your OS of choice, not in SQLite/SQLar.

You don't tell us outright that you're using Windows, but I can tell from your use of "`*.*`" that you are. Unix people tend not to use that wildcard because it means something different from a simple `*`, which is shorter and usually more correct besides.

This in turn tells me that you're using an OS where they decided that it's up to the called program to expand wildcards instead of leaving that to the shell. This has a number of bad side effects:

1. Most immediately relevant to you, it means the expansion of `*.*` doesn't happen until the program is up and running and the sqlar DB has been created, so expanding that wildcard will include the just-created file. On Unix type systems, the equivalent expansion happens before the program's even run, so your symptom doesn't occur there.

2. A lot of functionally duplicate code that doesn't behave the same way.  Even in the case where you assume the arguments are expanded by the underlying C runtime library, a program's command line expansion may function differently depending on whether it was built with VC++, GCC, Clang... In the case of GCC, it may differ between native GCC, MinGW GCC, Cygwin GCC... Then there's the fact that programmers being programmers, some aren't satisfied with the default wildcard expansion and so write their own, leading to still more different ways wildcards are interpreted.

    You may guess that the plethora of Unix shells means the same problem happens on the other OSes, but it doesn't for two reasons. One, a given user tends to use just one shell, so they can get used to how their shell expands arguments in all cases. Two, POSIX sets minimal rules that all POSIX-type shells must obey, so they can't drift too wildly. You still get some oddities like whether wildcard expansion happens in the middle of a word or not (e.g. zsh vs bash) but goto "One".

3. Programs not written in a language that has runtime support for glob expansion on program initialization (e.g. Windows batch files) have to do [tricks](https://stackoverflow.com/questions/23193767/how-to-call-a-windows-batch-script-with-wildcard-filenames-as-command-line-argum) to expand their args. It doesn't matter what language you write your program in on a Unix box: command line expansion is the shell's problem, so it always happens the same way, modulo the quibbles in point #2.

All of which is why I use a POSIX shell on Windows whenever possible. I get a consistent experience not just relative to macOS, Linux, BSD, etc. it means I get consistent behavior from one program to the next. The equivalent command 

      $ sqlite3 foo.sqlar -Ac *

doesn't add `foo.sqlar` to the archive because it doesn't exist yet at command line expansion time.

> there does not seem to be a command to remove a file from the archive.

That's true of the version built into the `sqlite3` shell, but not of [the standalone `sqlar` utility](https://sqlite.org/sqlar/). It got that feature [in 2016](https://sqlite.org/sqlar/info/b45aa9345e29efc7).

Perhaps that feature should be backported.