Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there,
I'm working on a program that moves files between a SFTP server and a local folder.
It works fine but I have a problem, seems as the tFTPGet copy the files from the SFTP and move them to the local folder but the files still remain into the SFTP. I do need to cut the files instead copy, is there any way?
I've tried with a tFTPDelete but this solution doens't work 100% as is for example during the process between the FTPGet and the tFTPDelete a new file comes it auto deletes as is on the SFTP and it's not copied.
So solutions that I think that can work:
1) Cut the files instead copy
2) Any rule into the tFTPDelete to only delete the ones listed into the tFTPFileList
Any ideas?
Thanks a lot!
you should connect each subjob. So connect
tFTPFileList_1 to tFTPFileList_2 with a OnSubjobOK
tFTPFileList_2 to tFTPFileList_3 with a OnSubjobOK
tFTPFileList_3 to tFTPFileList_4 with a OnSubjobOK
tFTPFileList_4 to tFTPClose_1 with a OnSubjobOK
This works for me:
tFTPFileList-----(iterate)---->tFTPGet----(componentOK)---->tFTPDelete
Delete the files as you get them.
thanks for the reply.
the thing is that I have other works before the delete so in that time that the work runs the system can generate other file (i've tested it) so in any way I need to ensure that it only delete the ones already copied.
Why not download the files and then do your 'other work' on the local copies?
If the 'other work' has to be on the ftp server, then rename the files, and do the other work on the renamed copies.
Rename the names make sense, I've tried before with tFTPRename but I don't know how to rename the files keeping the same name but adding some extra at the begining, like a OK_+"FILENAME" any idea how to do that?
If I put "" into the newname (on the tFTPRename) it keeps the same but cannot add the OK_ at the begininnig.
Thanks !
don't you have the name from your tFTPFileList for use in your tFTPGet? Maybe
"OK_" + ((String)globalMap.get("tFTPFileList_1_CURRENT_FILE"))
Thanks for the reply.
Tried to put it after the FTPGet but it shows me this error:
Exception in component tFTPRename_1 (MOVEORDERSDV)
3: Permission denied
Do I have to declare something into the tFTPlist?
try in the filemask:
((String)globalMap.get("tFTPFileList_1_CURRENT_FILE"))
instead of
"*"
To rename just that file.
Also, I would rename it first, and then "get" the copy.
Also, I don't understand why you are using a OnSubjobOK with your tFTPFileList, and then have 4 tFTPGet's. That implies that you "know" the file names and don't need the tFTPFileList to get the file names.
I mention this because the ((String)globalMap.get("tFTPFileList_1_CURRENT_FILE")) is only going to be the last file if finds, because it's used after the OnSubjobOK.
sorry, I just don't understand what you are trying to do.
It works but only with the first file, If I move more than 1 it only renames the first one.