Forum Discussion

YanSavinsky's avatar
YanSavinsky
New Contributor III
10 days ago
Solved

Files manipulation on SFTP Location

I need to move some files around the various folders on our SFTP server and I am trying to do it via the Extender BR. Basically I need to move the files from the staging folder into various other fol...
  • YanSavinsky's avatar
    5 days ago

    Hi, Daniel. 

    First of all, thank you for reaching out. The exception was that the target specified in the PutFiles function did not exist.

    What I figured out eventually is that "Put" and "Get" FTP commands are for moving files between the FTP location and remote location ( your local network folder, etc.). What I need to do is move the files within the FTP folder structure and for that I ended up using "MoveFile"

    		For Each x As RemoteFileInfo In remoteFiles.Files
    				
    				Dim newName As String = Nothing
    				
    				If x.Name.Contains("BalTran") Then
    
    					session.MoveFile(baiStagingLocation & x.Name, baiFolderLocation & "Chase/" & x.Name)
    
    				ElseIf x.Name.Contains("BoA") Then
    
    					session.MoveFile(baiStagingLocation & x.Name, baiFolderLocation & "BoA/" & x.Name)
    
    				ElseIf x.Name.Contains("Citi") Then
    
    					session.MoveFile(baiStagingLocation & x.Name, baiFolderLocation & "Citi/" & x.Name)					
    
    				ElseIf x.Name.Contains("Mizuho CAD") Then
    
    					session.MoveFile(baiStagingLocation & x.Name, baiFolderLocation & "Mizuho CAD/" & x.Name)	
    					
    				ElseIf x.Name.Contains("Mizuho") Then
    
    					session.MoveFile(baiStagingLocation & x.Name, baiFolderLocation & "Mizuho/" & x.Name)	
    					
    				ElseIf x.Name.Contains("MUFG") Then
    
    					session.MoveFile(baiStagingLocation & x.Name, baiFolderLocation & "MUFG/" & x.Name)						
    					
    				ElseIf x.Name.Contains("SMBC III") Then
    
    					session.MoveFile(baiStagingLocation & x.Name, baiFolderLocation & "SMBC III/" & x.Name)					
    
    				ElseIf x.Name.Contains("SMBC ITAI") Then
    
    					session.MoveFile(baiStagingLocation & x.Name, baiFolderLocation & "SMBC ITAI/" & x.Name)					
    
    					
    				End If
    				
    					
    				fileNumber += 1
    				
    			Next