On 6 December 2015 at 02:01, Roman Shaposhnik <ro...@shaposhnik.org> wrote:
> On Sat, Dec 5, 2015 at 1:32 PM, sebb <seb...@gmail.com> wrote:
>> However, I have just discovered that although SFTP has a recursive put
>> command, it does not have a recursive delete.
>>
>> Directories can only be removed when they are empty.
>>
>> As you can imagine, that makes tidying up after staging a website very
>> tiresome (especially ones with Javadoc and source xref)
>
> I was passively monitoring this thread and dusting off my expect(1) man page,
> but this could be a deal breaker even with automation.

It seems that sftp does not even support recursive listing, so one way
to automate the process would be to use ls -l to show the directories,
parse the response to find the subdirs, etc.
Possible, but pretty tedious, and generates a lot of unnecessary
network traffic.

Another option is to use rm *;rm */*;rm */*/* etc to the maximum depth expected.
That works for files.

Unfortunately it seems that rmdir * is not supported, so the
directories have to be done individually
This will require listing parsing as above, but at least the listings
will be somewhat shorter.

[Note that sftp supports batch input, so this can all be be done without expect]

Having rsync would make it somewhat easier.

> Thanks,
> Roman.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to