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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
rommy
Contributor III
Contributor III

tSystem Component - Unix cmd issue

Hi All,

I am trying to use unix rm command in t system component to remove the previous files, but its not working , I am using following line for cmd to run on unix box.

single cmd

"rm "+context.dir+"/file_loc/load*"

to remove all files starting with load, I dnt want to use get file list and other components to delete files, Can someone tell me what I am doing wrong ?

I tried with

"cmd /c"+context.dir+"/file_loc/load*" >> this failed too in a single cmd.

Thank you !

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hello ,

 

 

Your command must be:

 

new String[]{"/bin/bash","-c","rm"+context.dir+"/file_loc/load*"}

 

 

 

here, the difficulty where not the context.dir, but the * character at the end because it's a special character

 

cmd /c is for windows

For inbuild command on linux it's bash -c

 

You can also set an array of command with all the elements of the command string. More information aboiut special character usage here: https://community.talend.com/s/article/Executing-a-Linux-command-with-a-pipe-using-a-tSystem-component-IOBiH

View solution in original post

4 Replies
rommy
Contributor III
Contributor III
Author

Can someone pls guide me here ?

Prakhar1
Creator III
Creator III

could you please paste your error here ?

Anonymous
Not applicable

Hello ,

 

 

Your command must be:

 

new String[]{"/bin/bash","-c","rm"+context.dir+"/file_loc/load*"}

 

 

 

here, the difficulty where not the context.dir, but the * character at the end because it's a special character

 

cmd /c is for windows

For inbuild command on linux it's bash -c

 

You can also set an array of command with all the elements of the command string. More information aboiut special character usage here: https://community.talend.com/s/article/Executing-a-Linux-command-with-a-pipe-using-a-tSystem-component-IOBiH

rommy
Contributor III
Contributor III
Author

Thank you tsesdl (Talend) ,your solution worked !