Discussion:
tell if file is directory
Robert DuToit
2014-01-27 00:16:14 UTC
Permalink
Hi Alexander,

Is there a way to tell if a file is a directory via lftp on server. I need to differentiate for a script that downloads various chosen files and folders.

Locally no problem as I can just use the TCL command:

set is_dir [file isdirectory $this_file]

Thanks, rob
Alexander Lukyanov
2014-01-30 22:02:27 UTC
Permalink
You can try to use "cls" command, then analyze the output, or just try to
"cd" to the could-be-directory and act depending on the resulting exit
code, like this:

cd DIR && do-something
cd DIR || do-something-else
Post by Robert DuToit
Hi Alexander,
Is there a way to tell if a file is a directory via lftp on server. I need
to differentiate for a script that downloads various chosen files and
folders.
set is_dir [file isdirectory $this_file]
Thanks, rob
_______________________________________________
lftp mailing list
http://univ.uniyar.ac.ru/mailman/listinfo/lftp
Robert DuToit
2014-02-02 18:02:20 UTC
Permalink
Thanks Alexander,

Re: [lftp] tell if file is directory

I have used the cd test in other scripts but didn’t think of it here! Will give it a shot.

On another note:

I am running lftp from and Expect/TCl script which is interactive and pipe the output to a file. This is on OSX

Everything is working great but I just discovered that commands with paths with more then 30 chars ( sometimes 32, 34 but always more than 34 won’t work) in them are hanging. It is hard to reproduce in terminal since there are multiple commands run in sequence, cd mirror etc… I don’t know if this is lftp hanging or some odd effect from the Expect Script. If you have any thoughts as to where I can look to understand what is causing it - I would appreciate it.

Thanks as always, Rob
Post by Alexander Lukyanov
cd DIR && do-something
cd DIR || do-something-else
Hi Alexander,
Is there a way to tell if a file is a directory via lftp on server. I need to differentiate for a script that downloads various chosen files and folders.
set is_dir [file isdirectory $this_file]
Thanks, rob
_______________________________________________
lftp mailing list
http://univ.uniyar.ac.ru/mailman/listinfo/lftp
Alexander V. Lukyanov
2014-02-03 10:10:13 UTC
Permalink
Post by Robert DuToit
I am running lftp from and Expect/TCl script which is interactive and pipe the output to a file. This is on OSX
Everything is working great but I just discovered that commands with paths with more then 30 chars ( sometimes 32, 34 but always more than 34 won’t work) in them are hanging. It is hard to reproduce in terminal since there are multiple commands run in sequence, cd mirror etc… I don’t know if this is lftp hanging or some odd effect from the Expect Script. If you have any thoughts as to where I can look to understand what is causing it - I would appreciate it.
lftp can show shortened file names when they don't fit on a single terminal line.
Probably your expect scripts don't expect that.
--
Alexander.
Robert DuToit
2014-02-03 12:19:35 UTC
Permalink
Hi Alexander,
Post by Alexander V. Lukyanov
Post by Robert DuToit
I am running lftp from and Expect/TCl script which is interactive and pipe the output to a file. This is on OSX
Everything is working great but I just discovered that commands with paths with more then 30 chars ( sometimes 32, 34 but always more than 34 won’t work) in them are hanging. It is hard to reproduce in terminal since there are multiple commands run in sequence, cd mirror etc… I don’t know if this is lftp hanging or some odd effect from the Expect Script. If you have any thoughts as to where I can look to understand what is causing it - I would appreciate it.
lftp can show shortened file names when they don't fit on a single terminal line.
Probably your expect scripts don't expect that.
Yes - I think I observed the shortened filenames. Though in the script, Expect is just looking for the “lftp>" prompt to return, so it can continue. So as long as lftp returns the script should continue. I seems to log a few commands often (with the longer paths) and then hang. A bit of a mystery but I suspect it is Expect since I have seen other unexplainable behaviors. Expect spawns the lftp process, issues commands to it all in background. I assume you haven’t heard of any lftp issues with path names.

Thanks, Rob
Post by Alexander V. Lukyanov
--
Alexander.
Robert DuToit
2014-02-10 02:03:39 UTC
Permalink
Hi Alexander,
Post by Alexander V. Lukyanov
Post by Robert DuToit
I am running lftp from and Expect/TCl script which is interactive and pipe the output to a file. This is on OSX
Everything is working great but I just discovered that commands with paths with more then 30 chars ( sometimes 32, 34 but always more than 34 won’t work) in them are hanging. It is hard to reproduce in terminal since there are multiple commands run in sequence, cd mirror etc… I don’t know if this is lftp hanging or some odd effect from the Expect Script. If you have any thoughts as to where I can look to understand what is causing it - I would appreciate it.
lftp can show shortened file names when they don't fit on a single terminal line.
Probably your expect scripts don't expect that.
The script expects the return "lftp*>" prompt to continue but I have also tried "expect -exact $file_path” which would probably never find your shortened path. Is there a way to turn on “full paths always”


Thanks, Rob
Post by Alexander V. Lukyanov
--
Alexander.
Loading...