|
Posted by Brian V Bonini on 06/29/05 16:14
On Tue, 28 Jun 2005, Bob Winter wrote:
> Brian,
>
> The format of your string that works for me is :
>
> $cmd = "scp $user@stagingcws.$tld:$directory/\{$files\} $tmp_dir";
>
> $files must be a comma separated string with NO SPACES.
>
> Here is my complete test script for your review:
> ==== START =====
> #!/usr/bin/php
> <?php
>
> $file1 = 'file_A';
> $file2 = 'file_B';
> $file3 = 'file_C';
> $files = "$file1,$file2,$file3";
> $directory = '/tmp';
> $user = 'root';
> $tld = 'com';
> $tmp_dir = '/tmp/test';
> $cmd = "scp $user@bmw.$tld:$directory/\{$files\} $tmp_dir";
>
> exec($cmd, $output, $err);
>
> echo "string: $cmd \n";
> echo "status:$err \n";
> print_r($output);
> ?>
> === END ====
>
I tried that too. I get '/{a,s,d,f\}' in the string if I use it that way.
Are you saying that you were able to do a succesful transfer using the
above? I can output a string that SHOULD work, e.g. "scp
joe@foobar.com:/dir/{file1,file2,file3} /dir/." but when run from within a
php script it does not expand the stuff inside the braces. Instead it's
looking for a file literally named '{file1,file2,file3}' rather than
/dir/file1, /dir/file2, /dir/file3, etc. If you just echo the string it
will appear well formed, but try to actually use it and it will not work,
at least not for me.
-Brian
[Back to original message]
|