Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how to read and then delete a flat file on job server

hi all,

i have a requirement to read files from a folder on jobserver from a BODS job into an oracle server table.

this job to run once daily.

should read all files available at that moment.  [will use wild card to read file names like test*.csv ]

after reading, my BODS job should also delete all the processed files from the folder.

also i should make a note of those file names processed.

can anyone help me with this ?

Former Member
replied

I am sorry, you confused me a bit by the way you wrote the find-command .

If I am not mistaken, the correct syntax for the find-command is:

     find /folder -name 'filename_and_or_wildcard'

So in your case, it would be:

     find /usr/sap/test1 -name 'TEST*'    

Or as of your notation:

     /bin/sh -c "find /usr/sap/test1 -name 'TEST*'"

Calling this from a script in DS:

     exec('/bin/sh -c "find /usr/sap/test1 -name \'TEST*\'"',8);

Or when you put the filename prefix in a global variable:

     $variable = 'TEST*';

     exec('/bin/sh -c "find /usr/sap/test1 -name {{$variable}"',8);

Good practice when developing script is inserting some debugging statements, like

     print('/bin/sh -c "find /usr/sap/test1 -name {{$variable}"');

The trace file will show the generated command:

          /bin/sh -c "find /usr/sap/test1 -name 'TEST*'"

If the command fails, you can copy-and-paste it into your Linux command line and run it manually. That may give you a better understanding of the reason why. 

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question