More consolidation: Squirt

After spending some time cleaning up the mess of repsoitories that I have generated over the past few years, I thought it might be a good time to take a look at Squirt, a slightly larger project. In this case, Squirt still has its own repository but I have removed some branches. Now, instead of creating a seperate branch for every point release (because this is going to become very silly very quickly), I have two branches: development and master.

Obviously, the intention is to use development for any code changes and once I am happy with them, they will be pushed to master. Hopefully this will encourage to be a little less tardy about keeping the master branch up to date.

Squirt 0.2: Now with SMTP

As you may or may not be aware I have been tinkering with a command-line FTP client over the past year or so. And now seems as good a time as any to release version 0.2. The main change here is that the FTP client now supports sending data via SMTP.

In order for this to work, you need to be able to specify an SMTP server and port but, if you have a spare gmail account knocking around, server and port 587 will work quite nicely.

As ever, you can find all of the source on GitHub. Feel free to tinker around with it.

Squirt 0.1: Functionally Adequate

I think this counts as a release announcement.

Version 0.1 of Squirt, a Regex capable command-line FTP client is now available for download from GitHub.

This application started as an attempt to provide a simple way of maintaing frequently used simple FTP scripts and I have finally reached the point at which I can say that the core FTP functionality is now up and working. There is still a fair bit to do, but this release is both usable and provides a basis upon which it will be possible to develop a simple mechanism for managing scripts across a variety of protocols and, eventually, a mechanism for piping these scripts together.

Feel free to have a play with it and, if you do have any feedback, I would appreciate hearing it by way of the GitHub issue tracker.

Squirt 0.1

Some time ago, I started developing a command line FTP wrapper to allow me to quickly define and execute frequently used scripts. I have since spent a bit of time thinking about this and have now started extending it with the aim of supporting multiple protocols and, ultimately, some functionality to allow me to string scripts together.

I have created a development branch, 0.1 on GitHub, and will fix up the Squirt project page on this site sometime in the near future.

Although I don’t think that anyone is actually using this (apart from me, of course), I do want to note that switching to branch 0.1 will break the database (sort of).

When you run Squirt for the first time, the database will be created or updated. This time around the update will involve renaming the tables. In order to recover any pre-existing scripts you will need to go into sqlite with:

sqlite2 ~/.squirt.db

… and then execute the following scripts. In order

insert into squirt_scripts select * from scripts;
drop table scripts;
drop table config;

From this point forward, any database changes should be seamless.

Squirting big data

You may recall that a couple of weeks ago, I mentioned that that Squirt, a regex compliant command line FTP client, was falling over when handling very large files. I have finally found the time to take a look into this and finding a solution proved to be a lot easier than I expected.

In short, what the get and put functions now do is generate a list of files to squirt and then processes each file in its own FTP instance. This approach does make the app a little slower when handling multiple small files, but this is a cost worth paying for the massively increased reliability.

The code is a bit of a mess at the moment, and in dire need of some refactoring, but it can be found at GitHub if you are interested in how the workaround works.

A Frugal addendum: Downloading multiple files with Squirt

Since the Get Frugalware page doesn’t list any torrent trackers, I figured that this would be a good opportunity to test the regex aware capabilities of Squirt. Originally, I expected to include a one-paragraph note in my previous post but, as you will see, this expanded to the point that I decided a separate post was warranted.

The closest FTP mirror listed for me was, of course, the Belgian one. There are a lot of files in the stable ISO folder and all I really want to download are the four DVD images. With as little intervention as possible. This is the point at which I saw an opportunity to see how well Squirt would work with a real-world regex search on a previously untried server.

First, the script:
squirt build getfrugal --user=ftp --local=/home/paul/Torrents --remote=/packages/frugalware/pub/frugalware/frugalware-stable-iso/ --do=get --files=x86_64-dvd[1-9].iso$

Because this is an anonymous ftp connection, --user=ftp and --pass is not populated.

The regex is in the --files paramater: The [0-9] tells squirt to match any numeric value and the $ tells it to match the end of the string (so it selects the .iso files and ignores the .iso.lst and files.

Then I execute the script:
squirt exec getfrugal

The first run was less than successful. Downloading files this big leads to FTP timeouts, at which point things start to get messy. So to validate the regex is working, I tried this:

$ squirt exec getfrugal --do=ls
-rw-r--r-- 1 ftp ftp 4483710976 Feb 12 00:01 frugalware-1.6-x86_64-dvd1.iso
-rw-r--r-- 1 ftp ftp 4486856704 Feb 12 00:04 frugalware-1.6-x86_64-dvd2.iso
-rw-r--r-- 1 ftp ftp 4488953856 Feb 12 00:07 frugalware-1.6-x86_64-dvd3.iso
-rw-r--r-- 1 ftp ftp 4465885184 Feb 12 00:10 frugalware-1.6-x86_64-dvd4.iso

All four DVD ISOs, and nothing else, were successfully identified. So I can start claiming that Squirt is a regex compliant command line FTP client (how’s that for snappy?) but I can’t (yet) make any claims that it will work for large files.

So that’s my next task lined up.


Another quick update to flag the fact that another piece of functionality has been added to Squirt. This application now supports chmod, so it can be used to change the permissions for one or more remote files.

I can think of at least one case where I will use this, and the script is already ready to go.

Squirt: Now with added Put

And the tinkering with project Squirt continues. I have finally gotten around to implementing some put functionality to this application so that it can send files as well as receive them.

This means that the utterly basic functionality (get, put, list and delete) is now complete. There is still a lot more to do, but I do now have something that starting to look like it might actually become useful.

More flexible file selection in Squirt

Just a quick post to note that the file selection in Squirt is now a little more flexible and will now find a selected pattern anywhere in the file name rather than just at the front. This change also offers the (unexplored but potential) advantage of allowing for the use of regular expressions when selecting files.

In other news, the ls action now returns the file information (file size, date changed, etc.) rather than a simple list of file names.