Listing only file name of files in remote

While using rclone lsf --files-only it produces


I would like to have just the list of files


While it is possible to filter the output of rclone, it is complex.

I read all I could but did not find a native rclone only solution.
Is there any way to do that?

I am aware that there can be files with same name. The ideal solution would be to have path and filename, but not in the same string …


Rclone doesn’t do that right now. Should be easy to parse though.

rclone lsf remote: --files-only --recursive 2>&1 | sed 's!.*/!!'
1 Like


being a windoze I always forget about sed… I was trying to parse it using just pure cmd commands…

1 Like

What are you doing with just the file names?

I am feeding filename and its mega publiclink to a sqlite3 to handle assets, so I can send a pdf with name and link to relatives… So, end product is not needing the full path, althought I will keep it in the DB as reference. I use md5 of filename as index so removing the path is interesting, althougth this is transitory cause I plan to use the file md5 instead.

Easier: basename -a $(rclone lsf --files-only --recursive remote:/path/)


Unfortunately, I haven't really used Windows in a long time. According to this, you should be able to use the variable %~nx<variable name>. And according to this, something like this should work:

for /f %%x in ('rclone lsf --files-only --recursive remote:/path/') do echo %~nxx

Keep in mind that I have absolutely not tested this since I haven't let Windows touch my computer for a long time now.


ups, my question was fully unclear; I was meaning if there was any baseline implementation for windows.
But your comment pointed me to a nice discussion here with full explanation of how to achieve the desired outcome and moreover a pointer to a baseline in windows

Besides I found a clean interesting approach here - (need to check if covers non-ansi...)

I already tried to use for loops and similar elements, but, inside bats and with spaces in filenames and non-ansi chars and ... blablabla... I was unable to find a safe way to implement it... Just chopping an chopping in going down levels (I went up to four subdirectories, then I stopped), as I was unable to make the recursivity work...


1 Like