Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Get Files from FTP server to Local Machine

Dear all,
I got struck in one issue which is as follows:
Requirement:
1) Get text file from FTP server to Local Machine, if we get files then rename this file by yyyyMMdd+name of the file+OK.text
2) We need to delete those text file from local folder which are 1 month OLD.
Development:
1) I have used Tftpget component to get files from FTP server to Local Machine, but i am unable to RENAME it LIKE yyyyMMdd+name of the file+OK.text becase i am not able to provide path of this file(Local Machine path).If i give remote directory path in tftprename component then it work but it rename in FTP server which i dont want.i want to make change of name in LOCAL machine only.

2) Not yet done.
Can you please help me with step by step process ....pleaseeee...
Thanks & Regards
RSH
Labels (2)
16 Replies
Anonymous
Not applicable
Author

Hi,
Get text file from FTP server to Local Machine, if we get files then rename this file by yyyyMMdd name of the file OK.text

Actually, there is no component to just rename a file on your local machine. You can either use tFileCopy and check "Remove source file" or use tSystem to call a system command or tJava with your own code.
We need to delete those text file from local folder which are 1 month OLD.

If the source file name has yyyyMMdd name(such as: 20130725xxOK.txt), you can use a specified file mask in tFileList to get the 1 month OLD source file and then delete them by tFileDelete.
Best regards
Sabrina
Anonymous
Not applicable
Author

Hello Sabrina ,
Can you please guide me what code to write in tsystem to change file name?
My file path is "D:/Talend/Project/Finacle/_Logs/Log.txt"
I want to rename this file (Log.txt) to "yyyyMMDD+Log+OK.txt"
Or is there any easy way to do it?
Thanks & Regards
RSH
Anonymous
Not applicable
Author

Hello Sabrina & Team,
Good Morning !!!
I am trying to change file name by using tsystem component with following command:
Files path is : "D:/Talend/Project/Finacle/_Logs/Log.txt" Reguired name of file is : Changed_Log_File.txt
in Tsystem i am using folowing command :
"cmd /c REN D:/Talend/Project/Finacle/_Logs/Log.txt Changed_Log_File.txt
I am getting an error of incorrect syntax. Can you please guide me how should i RENAME my old file with new name.
Thanks in Advance.
Regards
RSH.
Anonymous
Not applicable
Author

Hi,
You can use use tFileCopy and check "Remove source file"(if you don't want the source file).
To make it clear, I have designed a demo job: tfilelist-->iterate-->tfilecopy
See my screenshot for details
Best regards
Sabrina
0683p000009MAqt.png 0683p000009MAyx.png
Anonymous
Not applicable
Author

Hello Sabrina,
Thanks for your guidance... 0683p000009MACn.png
I made the job just like you but getting errors like:
Exception in component tFileCopy_1
java.lang.RuntimeException: The source File "/home/FTP_Server/LOGS_Folder/LOG.txt" does not exist or is not a file.
My requirement is to Get file from FTP server to Local Machine and is it is successful then RENAME this file,
so is tfilecopy component Copy files from FTP server to Local machine?
Please advice me because i am running out of time for deployment.
Thanks & Regards
RSH
Anonymous
Not applicable
Author

Hi,
Exception in component tFileCopy_1
java.lang.RuntimeException: The source File "/home/FTP_Server/LOGS_Folder/LOG.txt" does not exist or is not a file. My requirement is to Get file from FTP server to Local Machine and is it is successful then RENAME this file,
so is tfilecopy component Copy files from FTP server to Local machine?
Please advice me because i am running out of time for deployment.

The tFileCopy component cannot copy a file from FTP to Local machine. You should get the file from FTP to local machine firstly and then use tFileCopy to rename them.(If you don't want to use tFTPrename to rename files in FTP).
That means: tFTPConnection-->onSubjobOK-->tFTPget-->onSubjobOk(onComponentOk)-->tfilelist-->iterate-->tfilecopy.
In tFTPget, the files has been got from FTP into Local Machine where you can use tfilecopy to copy and rename.
Best regards
Sabrina
Anonymous
Not applicable
Author

Hello Sabrina,
I tried to work in my job as per your guidance and i got SUCCESSFUL Run..\
Thanks you Sabrina .. 0683p000009MACn.png 0683p000009MACn.png 0683p000009MACn.png
Some Snapshots i am attaching for all other developers...
Now i just remain with DELETE those files from Log folder which are 1 month OLD.
Thanks & Regards
RSH
Anonymous
Not applicable
Author

Hi,
Now i just remain with DELETE those files from Log folder which are 1 month OLD.

What the file name looks like?yyyyMMDD+Log+OK.txt?
If the source file name has yyyyMMdd+name(such as: 20130725xxOK.txt), you can use a specified file mask in tFileList to get the 1 month OLD source file and then delete them by tFileDelete.

Is it working for you?
Best regards
Sabrina
Anonymous
Not applicable
Author

Hello Sabrina,
I tried to work in my job as per your guidance and i got SUCCESSFUL Run..\
Thanks you Sabrina .. 0683p000009MACn.png 0683p000009MACn.png 0683p000009MACn.png
Some Snapshots i am attaching for all other developers...
Now i just remain with DELETE those files from Log folder which are 1 month OLD.
Thanks & Regards
RSH