cancel
Showing results for 
Search instead for 
Did you mean: 

Building OS command for linux equivalent to windows

saravanan_a
Active Participant
0 Kudos

Hi Experts,

Through one of the forum I came to know that inorder to get filename at receiver side as "filename+date" I have to use

Run Operating System Command After Message Processing (http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=272171407)

and command as  cmd.exe /C "ren %F filename_%DATE%.txt"

this is for windows environment.

My question is how to modify this statment to make it works for linux based system (receiver system)

I need equivalent command in linux for above mentioned command in windows.

Please suggest.

Regards,

Saravanan

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

try this:

mv %F filename_%d%m%y.txt

saravanan_a
Active Participant
0 Kudos

Hi Rajeev,

No its not working.

Former Member
0 Kudos

try this:

in receiver file comm channel, in target tab page, in File Name Scheme give test - means give target filename as test

in OS command give mv test filename_%d%m%y.txt

former_member184681
Active Contributor
0 Kudos

I think I got it for you. Try adding "sh" at the beginning, so that the command that you type later was executed in the shell, for instance:

sh mv %f filename_%d%m%y.txt

If you still experience problems, change it to:

sh mv %f filename_%d%m%y.txt | log.txt

Thanks to this, you should be able to capture the error given by the script into the log.txt file and analyze the problem further.

Regards,
Greg

baskar_gopalakrishnan2
Active Contributor
0 Kudos

mv command in unix or linux to change or rename the file name from original name to new name.

Example:

sh  mv file1 file2   // where file1 is original and file2 is new.  I don't see in your command two file names. That is the reason you get the error file not found. Hope that helps.

sh mv filename_original filename_%d%m%y.txt | log.txt

@Rajeev Gupta: Pointed above correctly.

@Greg:  Please refer your post http://scn.sap.com/thread/3149281. You said mv command for moving and not renaming. You here use mv for rename.You pointed me same in one post. Are you not confusing the user or providing untruth answer? This is wonderful forum to explore and share our ideas. Please don't discourage others. Moderators are available to take necessary actions.

former_member184681
Active Contributor
0 Kudos

I don't see in your command two file names.

Actually, in the following command: sh mv %f filename_%d%m%y.txt

So the requirement to provide two file names that you mentioned is satisfied.

Are you not confusing the user or providing untruth answer?

Of course not. See in some Linux helps or forums that renaming a file can be achieved in Linux in several different ways:

There is no ren command in Linux. The usual commands used to rename file in Linux is mv, rename or cp command.

Quoted from here: http://www.basicconfig.com/linux/mv

My point is simply Saravanan A solve the problem. And what will help him solve his problem is adding "sh " at the beginning of the OS command. It does not really matter whether he uses rename or mv (although rename is a dedicated command for renaming, while renaming a file is only some sort of side effect when using mv).

Regards,
Greg