How to create a directory in SFTP using Talend tFTPCreateDirectory?

Six Stars

How to create a directory in SFTP using Talend tFTPCreateDirectory?

I need to copy the files from one directory in FTP to another FTP server, so I will need to create the directory in the destination server. I imported the tFTPCreateDirectory component into Talend and hoped it would do the job. But unfortunately, it didn't. Here is what I have now:

If the destination server has the same folders as the source server, the job will run and it says "the directory already existed, the creation will be skipped";

If the source server has the folders that don't exist in the destination, the job would fail and it says something like " The files could not be found".

 

Can someone tell me what could be wrong in the configuration of the tFTPCreateDirectory?

Thanks!

Eight Stars

Re: How to create a directory in SFTP using Talend tFTPCreateDirectory?

Hi,

 

Does the user you're connecting the the FTP server with, have the required permissions to create directories? Also, are you creating a tree like structure of multiple directories?

 

Say: Files/2018/2018-07/2018-07-31

 

if the 2018 doesnt exist under files, then the component might not allow creation of sub-folders in one go.

 

Thanks

 

David

Regards

David

Don't forget to give Kudos when an answer is helpful or the solution.
Six Stars

Re: How to create a directory in SFTP using Talend tFTPCreateDirectory?

Hi David,

 

Does the user you're connecting the the FTP server with, have the required permissions to create directories?

-- Yes, our server admin has tested the user for me, it has the permissions to create directories.

 

are you creating a tree like structure of multiple directories?

In my local machine (which is the source), I have folders:

Division 1 ->Departments

Division 2 ->Departments

Division 3 ->Departments

Div 4    ->Departments

Div 5    ->Departments

 

In the destination server, the current existing folders are:

Division 1 ->Departments

Division 2 ->Departments

Division 3 ->Departments

 

When I ran the job, it threw an error:

[statistics] connecting to socket on port 3481
[statistics] connected
Exception in component tFTPCreateDirectory_2 (movefiles)
2: The requested file does not exist
at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2846)
at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2198)
at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2215)
at com.jcraft.jsch.ChannelSftp.stat(ChannelSftp.java:2172)
at pl_project.movefiles_0_1.movefiles.tFileList_2Process(movefiles.java:796)
at pl_project.movefiles_0_1.movefiles$4.run(movefiles.java:1652)
[statistics] disconnected

 

If I deleted the Div 4, Div 5 from the source, and ran the job again, it succeeded:

[statistics] connecting to socket on port 3671
[statistics] connected
Directory /XXX/Divisions//Division 1 already exist, skip creation step.
Directory /XXX/Divisions//Division 1/DEPARTMENTS already exist, skip creation step.
Directory /XXX/Divisions//Division 2 already exist, skip creation step.
Directory /XXX/Divisions//Division 2/DEPARTMENTS already exist, skip creation step.
Directory /XXX/Divisions//Division 3 already exist, skip creation step.
Directory /XXX/Divisions//Division 3/DEPARTMENTS already exist, skip creation step.
[statistics] disconnected

Eight Stars

Re: How to create a directory in SFTP using Talend tFTPCreateDirectory?

You might find it easier to not use that custom component and use a tSSH component to create the directory.

 

Thanks

 

David

Regards

David

Don't forget to give Kudos when an answer is helpful or the solution.
Six Stars

Re: How to create a directory in SFTP using Talend tFTPCreateDirectory?

Hi David,

 

I agree that I should try to use tSSH component instead of tFTPCreateDirectory. My problem now is I can't get the tSSH component to work, something is not right with the configuration.

 

Thanks,

TigerMommy