SFTP node missing items path [GOT CREATED]

n8n is awesome but it still lacks some details that may be blocking.

In my case I need to synchronize folders and subfolders available via SFTP to a dropbox account.
I need to compare folders on SFTP and Dropbox as the content is quite heavy and I can’t sync everything on each run.
Fortunately directory structure is known and limited in depth:

-- Root
  |-- TeamFoo
    |-- 2020-08-24
      |-- File1.bin
      |-- File2.bin
      |-- File3.bin
    |-- 2020-08-25
      |-- File1.bin
      |-- File2.bin
      |-- File3.bin
  |-- TeamBar
...

My approach is to list Root on both SFTP and Dropbox, wait for both to complete (merge), diff results with a function and create missing team directories on Dropbox and then proceed to list the content of each team directory and again compare to create missing directories.
However I cannot create those nested dirs as I can’t manage to attach the path of each listed directory to the items output by the SFTP node. I’m left with the sole name directory name thus I can’t instruct subsequent dropbox node to create the folder.

I tried messing with split batches and set nodes to add it by myself but at best I manage to attach the path to the first directory but not to the others. Not to mention that this step would make the workflow even more complex…

Adding the path of directories and files to items from SFTP would greatly simplify the task and adding an option for recursion would make it a breeze :smiley:
Maybe consider doing the same on Dropbox node and other storage nodes.
At least a workaround would be a good start.

Any help would be appreciated

@Lipper Welcome to the community. @Ronalds_Upenieks created the node, he might be able to help you.

Hi @Lipper, I will have a look at this issue this week. Will keep you posted. :slight_smile:

I appreciate, thanks!

@Lipper

I’ve just implemented recursive directory listing for the FTP node. To use, simply enable the “recursive” boolean option.

This will make it seek through each possible file and directory and keep fetching everything within until all is gathered. n8n will return a list of objects, each representing a file or a directory within the SFTP server.

The path of each item will be under a “path” property. If an items type is “d”, it means it’s a directory.

Will be released with the next n8n versions, I’ll post here once it is.

Hope this helps and let me know if there’s any other issues.

Thanks.
Ronald.

2 Likes

Great! That would make possible my first real world n8n workflow.

1 Like

Got released with [email protected]