Secure FTP plugin - sorting of symlinks to directories

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: sheep, Hacker, Stefan2, white

Post Reply
Nux
Junior Member
Junior Member
Posts: 39
Joined: 2009-04-19, 08:05 UTC

Secure FTP plugin - sorting of symlinks to directories

Post by *Nux » 2017-11-29, 13:59 UTC

Symlinks (ln -s) to directories are sorted with files. This makes it harder to copying new files as those links to directories get tangled in with files.

Would be great if the Secure FTP plugin could make TC handle them as directories.

SFTP protocol seem to pass information about links to directories correctly. Or at least WinSCP handles symlinks as expected (at least for the sorting part).

[del]PS: I'm using TC 9.0 at the moment, but I haven't found info about changing that in 9.10.[/del]
PPS: Updated to 9.12 and verified the problem still occurs.
PPPS: Also updated the plugin to 2.0.0 :-). Unfortunately the problem is the same.

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 38145
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) » 2017-12-01, 15:17 UTC

Unfortunately ln -s doesn't tell whether a link points to a file or a directory. :(
Author of Total Commander
http://www.ghisler.com

Nux
Junior Member
Junior Member
Posts: 39
Joined: 2009-04-19, 08:05 UTC

Post by *Nux » 2017-12-02, 12:26 UTC

If you are using `ls` command to list contents then you might want to use "-L"

Without `-L` it is not grouping linked directories:

Code: Select all

[me@www flyspray_copy]# ls -l --group-directories-first
razem 32
lrwxrwxrwx 1 me me   17 2014-10-27  adodb -> ../flyspray/adodb
lrwxrwxrwx 1 me me   31 2014-09-23  attachments -> /var/www/flyspray/attachments
lrwxrwxrwx 1 me me   25 2014-09-23  cache -> /var/www/flyspray/cache
lrwxrwxrwx 1 me me   17 2014-10-27  cliph -> ../flyspray/cliph
-rw-r--r-- 1 me me 4553 2014-11-05  flyspray.conf.php
-rw-r--r-- 1 me me 2462 2010-09-10  header.php
lrwxrwxrwx 1 me me   20 2014-10-27  includes -> ../flyspray/includes
-rw-r--r-- 1 me me 6090 2011-03-07  index.php
lrwxrwxrwx 1 me me   22 2014-10-27  javascript -> ../flyspray/javascript
lrwxrwxrwx 1 me me   16 2014-10-27  lang -> ../flyspray/lang
lrwxrwxrwx 1 me me   20 2014-10-27  lightbox -> ../flyspray/lightbox
lrwxrwxrwx 1 me me   19 2014-10-27  plugins -> ../flyspray/plugins
-rw-r--r-- 1 me me   36 2010-09-10  robots.txt
-rw-r--r-- 1 me me 4358 2013-09-03  schedule.php
lrwxrwxrwx 1 me me   19 2014-10-27  scripts -> ../flyspray/scripts
lrwxrwxrwx 1 me me   21 2014-10-27  templates -> ../flyspray/templates
lrwxrwxrwx 1 me me   18 2014-10-27  themes -> ../flyspray/themes
With `-L` it show exactly what you need :-)

Code: Select all

[me@www flyspray_copy]# ls -lL --group-directories-first
razem 676
drwxr-xr-x 7 me   me   4096 2014-02-26  adodb
drwxr-xr-x 2 apache me 610304 12-02 09:47 attachments
drwxr-xr-x 3 apache me   4096 2015-06-18  cache
drwxr-xr-x 2 me   me   4096 2014-02-26  cliph
drwxr-xr-x 3 me   me   4096 2014-02-26  includes
drwxr-xr-x 7 me   me   4096 2014-02-26  javascript
drwxr-xr-x 2 me   me   4096 2014-02-26  lang
drwxr-xr-x 6 me   me   4096 2014-02-26  lightbox
drwxr-xr-x 3 me   me   4096 2014-02-26  plugins
drwxr-xr-x 2 me   me   4096 2014-02-26  scripts
drwxr-xr-x 2 me   me   4096 2014-05-16  templates
drwxr-xr-x 3 me   me   4096 2014-02-26  themes
-rw-r--r-- 1 me   me   4553 2014-11-05  flyspray.conf.php
-rw-r--r-- 1 me   me   2462 2010-09-10  header.php
-rw-r--r-- 1 me   me   6090 2011-03-07  index.php
-rw-r--r-- 1 me   me     36 2010-09-10  robots.txt
-rw-r--r-- 1 me   me   4358 2013-09-03  schedule.php
Hope this helps.

If using this would consume more resources then maybe add and an option to follow symlinks?

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 38145
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) » 2017-12-04, 15:05 UTC

But with -L it doesn't show whether a directory is really a directory or a link to a directory.
Author of Total Commander
http://www.ghisler.com

zeeko
Junior Member
Junior Member
Posts: 22
Joined: 2009-02-21, 19:57 UTC

Post by *zeeko » 2017-12-05, 19:26 UTC

You could try with -F switch. It keeps l flag and marks directory names with / suffix.

Code: Select all

#ls -Fla
lrwxrwxrwx 1 me None   12 dec  5 20:08 'SymbolicLink.bash_logout' -> .bash_logout
drwxr-xr-x 1 me None    0 dec  6 20:20  .config/
lrwxrwxrwx 1 me None    7 dec  5 20:08 '.config - SymbolicLink' -> .config/
-rw-r--r-- 3 me None   21 dec  8  2014  .bash_logout

Post Reply