Sorry I didn't see your msg earlier. Doesn't look like anyone else
did, so I'll answer.
Here is my solution; I'm certain it can be improved. Please contact me
with improvements. :-)
I made two local scripts: one to change both directories to the home
dir, and one that then performs both cd & lcd relative to that home
dir. I then made aliases to run those two scripts: "home" and "go".
Script to change both directories to the home dir (and to report the
directories afterwards):
#!/usr/bin/php
<?php
$my_command ="cd /filepath/content/; lcd /local_filepath/content/; pwd; lpwd;";
echo $my_command . "\n";
?>
Script to cd & lcd:
#! /usr/bin/php
<?php
// This script assumes you've already set the lcd and cd to
// the site's root directory. That's important!
$sep = " ";
// Remove the script name, the first argument, from argv
$argv = array_slice($argv,1);
foreach ($argv as $path) {
$my_command = "cd $path; lcd $path;";
}
echo $my_command . "\n";
/* In lftp, you should run this script as:
source -e ! php thiscript.php
The ! will run this script
The "source -e" will use the output as commands to lftp
*/
?>
and the aliases, which you'll want to put in your .lftprc file:
alias go source -e ! /a_filepath/lftp_go_mod1.php
alias home source -e ! /a_filepath/go_home.php
Please feel free to reply with, "but that's stupid, you should do..."
thanks,
CC
On 9/11/07, Morten Lemvigh <[EMAIL PROTECTED]> wrote:
> Is it possible to define new commands? I would very much like to have a
> combined cd and lcd, so the working directory is changed both locally
> and remote, if the specified path exists in both places.
>
> Since I have the same (relative) directory structure locally and on my
> server, it would save me a lot of time when I use lftp manually.
>
> Regards,
> Morten
>
--
--> CC <---