on 03-23-2012 4:21 AM
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
try this:
mv %F filename_%d%m%y.txt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.
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
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.