VFS plugin for mc


can someone with better knowledge in perl than me make a vfs plugin to visualize remotes in mc?

will it be better that copying to mount directories?


Did you try rclone ncdu that is quite a good visualisation tool.


it is not for visualization it is for management (long copy and move tasks)


I don’t think I understand your question. Can you explain more please?


have you used mc sometime? is a filexplorer for changing over folders by ncurses.

So you can copy from one tab to another. I would like to do this without having to mount the folder. and in background do the copy task (if it is possible with %). (there are systems that dont support fuse)

In one side the / in the other the folders read in .rclone.conf, and if i click in crypted: the folder goes to another one that lists the files inside, and if i go over the folder i can move and see what it has. And if move from this to / the file is move in background doing rclone move. instead of cp over filesystem.

Would this be too slow?


I haven’t used it for a very long time, but I know what you mean. The rclone ncdu interface is a bit like one half of the mc interface I think.

So are you thinking there should be an rclone mc command which would implement this? I have thought about this in the past.

It would probably work quite well. Using rclone move is more efficient that using cp in the filesystem and more reliable too.


I am thinking in Mc plugin that calls rclone to do this


I can’t find the homepage or source for mc - do you know where it is?


I believe its here unless I am mistaken about what mc is referring to.


this is what i am asking about. they are in c, but i know it would be easy to do them in perl or perhaps go?

more utils in this directory /usr/lib/mc/extfs.d


I see - thanks.

I see the VFS plugins written in C… I think you’d probably have to write new plugins in C. Maybe a shim plugin could be written which then called external functions (eg rclone) to do its work. It is probably quite a lot of work though.


apt install mc in your linux system and look into this file

/usr/lib/mc/extfs.d/uzip it is perl no? i think it wont be so difficult to make a plugin … if it is in c it would be as you say


That looks like the thing! There is even a hepful README

So what we are talking about is writing an extfs plugin for mc…

I think this could probably be written as a shell/perl/python script quite easily.

Or it could be a new rclone command say rclone mcplugin which you call with the parameters for the plugin script.

Anyone fancy having a go?


i am just trying to imagine or do a sample in doing this.

the script needs to have 4 commands list rm copyin copyout so it is no so hard to do this.

The problem i am seeing is that list needs to have full scan of remote (ls -lR) how intensive is this? as i have so much files … doing a full ls -lR … would last long and i dont know if i can get banned with doing this


mc support would be really great, as it wouldn’t have any root/mount/fuse requirements. BTW mc works just fine in Android/termux

However listing the whole remote can be really expensive - for many people probably no-go. We might be looking at the wrong type of plugin - this seems to be geared towards archives where it’s easy to get the complete listing


Ha! I’ve found something promising at least at first sight: https://github.com/MidnightCommander/mc/tree/master/src/vfs/fish/helpers

I’m a bit fuzzy about how it is precisely configured (probably you define a shell link against the local machine and on the local machine you make put some config file that contains stuff like:

#LIST /directory
ls -lLa $1 | grep ‘^[^cbt]’ | ( while read p x u g s m d y n; do echo "P$p $u.$g
d$m $d $y
"; done )
ls -lLa $1 | grep ‘^[cb]’ | ( while read p x u g a i m d y n; do echo "P$p $u.$g
dD$m $d $y
"; done )
echo ‘### 200’

but with rclone equivalents.

We don’t seem to need recursive ls. Transfer (STOR/RETR) is done from/to pipe which probably can be done via a temp file if needed (I guess not the optimal use of rclone capabilities but decent if you need just to snatch a couple files).


That looks interesting - yes! A shell script to do that might well be possible.


better with this (lua integration inside mc)

https://github.com/mooffie/mc/blob/luatip/src/lua/tests/nonauto/luafs_mirror.lua from mc^2 or mc2


i am going to give it a try … although i am not so sure about how to do copyes (from file read string and copy string to fs? i ll be able to call rclone copy?


Great :smile:

You can use rclone copy or rclone copyto to copy a single file to a remote.


the problem is within lua … i dont know when it is the mc copy command called and how to hook to it. i have asked