on 11-28-2006 5:32 PM
Hello,
i have the following configuration in the file receiver adapter:
Directory: /tmp/
File Name Scheme: %name%.txt
Variable substitution:
Variable Name: name Reference: payload: record,1,name,1
Run Operating system command:
/usr/bin/zip /tmp/%f.zip %F
The execution is succesful, but i have a small problem. The file name is "file.txt.zip", the .txt should appear but i dont know how to skip it, I have tried so many ways but it doesnt work, I should receive a file called "file.zip" With a file inside in txt format...
Thanks,
Luis
iam not sure wether it works.
now write one more simple grep command to rename the filename to filename .txt inside zip file.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Luis~
Grep wont work - its for searching strings in a file.
'mv' command might do the trick but since you also have the complexity of not being able to create scripts, try if Pipes (|) can do your job.
For usage of mv - check this link on batch renaming files.. in your case the output of zip command may need to Piped back to mv which will remove the 'txt' from the extension.But dont have access to a unix box to get you the right stmt..so pls excuse.
Hi Sriram,
Thanks, but that wouldnt work out, Im using the %f for my file name, so this move command shouldnt work for me, because my filename changes in every execution, so I cant write something like this: mv file.txt.zip file.zip
The only solution I see would would be a command which deals with strings and that could remove the four last characters of "%f"..but I havent found anything for doing it.
Regards,
Luis
Luis
It wont work standalone but its possible using pipes.You can pass outputs from command to command @ prompt using | symbol for redirection.Check up standard unix commands/scripts to see if you can pass the file name from Zip command to a mv using redirection.Else you may have to go the script route and check with the BOX admin to see if he can create one such script for you which you can call from File adapter.
Hi,
If you don't want the file name like "file.txt.zip" and if you want only "file.zip",
then changethe File Name Scheme: %name%
is this is the requirement ?
Regards,
Moorthy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Instead of achieving both in a single command..I think this can be done by Writing simple shell script which will receive the file name as parameter and do the zip using
zip -mR9yT archive original..
Archive- Archive Name after stripping off .txt from variable and
original should be .txt.zip file..
Let me know if it worked, dont have a unix system with me to test this out.
Yes I do message content conversion, but I think it doesnt have anything to do with this. It has something to do with the operating system command. The name of my file is inside my xml message, inside one tag, and I put it in the variable called "name". I wrote that configuration above.
Regards,
Luis
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.