How to delete a file by using batch file

hi
i tried for deleting a file from batch filr in Linux environment.
it is working when i run batch file thruogh command line.
but its not woking through program.
i am sending tha code that i used in tha program.
First i have to create the file and send the information to that file
and the content from taht file after that i have to delete the file.
For that i wrote code but the batch is not woking.
Batch file
@echo off
rm filename
Actual Program Code
I used RunServer
public class RunServer extends Object
RunServer();
String cmdServer = "test.bat";
Runtime run = Runtime.getRuntime();
Process p = null;
try
p = run.exec(cmdServer);
catch(IOException e)
System.out.println("Error:"+e);
By using RandomAccessFile i am creating a file
please help me
Thankyou

1) You can't execute a batch without having a shell.
2) It's totally stupid to run a one-line batch file from system.exec.
3) It's also totally stupid to delete a file using Runtime altogether.
But there you go...

Similar Messages

  • How to generate a PDF output using batch file in 10G

    Hello,
    I am using .bat file to generate a report PDF output. I have done this many times in 6i but for 10G I am unable to do the same.
    Can someone please look at the syntax below and let me know where I am going wrong.
    I understand that reports are different for 6i and 10G specially .rep file but I am sure we should be able to generate a PDF file using 10G. Please let me know.
    Thanks
    IQ
    Contents of .bat file follow
    ECHO Opening parameter form. Please do not close this window.
    C:\
    FOR /F "tokens=1 " %%I IN ('time /t') DO (SET _TIME=%%I)
    FOR /F "tokens=2 " %%I IN ('date /t') DO (SET _DATE=%%I)
    SET EXP_DATE=%_DATE:~6,4%%_DATE:~0,2%%_DATE:~3,2%_%_TIME:~0,2%%_TIME:~3,2%
    SET FILENAME=SEND_EMAIL_%EXP_DATE%_%USERNAME%.PDF
    CD C:\Users\Documents
    RWCONVERTER REPORT=C:\Users\Documents\send_email.rep USERID=scott/tiger@ORCL1 ORIENTATION=LANDSCAPE DESFORMAT=PDF DESTYPE=FILE
    DESNAME=C:\Users\\%FILENAME% PRINTJOB =NO

    Rwconverter is not used to run reports:
    rwconverter (Reports Converter) enables you to convert one or more report definitions or PL/SQL libraries from one storage format to another.
    I think you mean rwrun:
    rwrun (Reports Runtime) runs a report by starting its own in-process server (not to be confused with the default in-process Reports Server), which runs in the same JVM as the rwrun process.
    This bat file has to run on the server. There is no Reports installation on the client anymore.
    If you want to run a report from a client, you can make a bat file that calls the report url
    See: http://download.oracle.com/docs/cd/E14571_01/bi.1111/b32121/pbr_cla002.htm#i634710

  • Delete folder in a particular scenario using batch file

    How to achieve this using a batch file?
    The batch file should check if inside this folder "c:\test\", a directory named "temp1" only is present. If so then delete the folder test, but if the folder test contains more directories and files other than "temp1" directory, then just remove the "temp1" directory alone.
    Regards,
    Mathan

    First, why are you asking about this in a LabVIEW forum? I would suggest starting with Google.
    Second, you could simplify your algorithm by deleting temp1 and then checking if the test dir is empty or not. The Windows command is rd, if memory serves, but I believe that doesn't work on non-empty directories, so you might need to add switches to it or use another command. You could probably even simplify it by trying to delete test and letting it fail, so something like this:
    del c:\test\temp1\*.* (add switch for quiet mode).
    rd c:\test\temp1 (and check if there is a recursive switch)
    rd c:\test (should fail if not empty).
    Try to take over the world!

  • How to use batch files to send the load from ODC to UCM?

    Hello all.
    We're trying to do this along this week and, until now, we couldn't figure out how to use batch files containing metada on ODC and commit the output files to UCM.
    So these are our specs:
    VM 1
    ODC - 10gR3
    OS - Windows XP 32 bits SP3
    DB - Oracle DB 11.2
    VM 2
    No ODC
    UCM 11.1.1.6
    OS - Enterprise Linux Enterprise Linux Server release 5.5 (Carthage)
    We've opened a ticket with Oracle Support to know how we should do this. The number is SR 3-6108348211.
    Let me try to explain what we want to do:
    1 - we have a batch file with all metadata of many files from UCM
    2 - we want to use this file in ODC, so the application will convert the images and commit them to UCM
    3 - we should see all these files, their metadata, thumbnails and related content in UCM
    4 - this is a batch file example we want to send to ODC:
    @Properties LocalData
    IdcService=CHECKIN_UNIVERSAL
    dRevLabel = 1
    primaryFile=/tra/Relatorio_UHPF-03-04-2008-M-RL-EA.pdf
    dDocName=TRA_33
    dDocTitle=UHPF-03-04-2008-M-RL-EA
    dSecurityGroup=MAM_TRA
    dDocType=Document
    dDocAuthor=luis.neotropical
    dInDate=14/05/08
    xC_CLASSIFICACAO=EA - Educação Ambiental
    xC_DATA=01/04/08
    xC_DATAVALIDADE=30/04/08
    xC_LOCALIZACAOFISICA=N/D
    xC_USUARIO_DEP=LUIS FERNANDO DA CAMARA
    xC_TIPO=RL - Relatório
    xC_USINA=UHPF - USINA HIDRELÉTRICA PASSO FUNDO
    xC_FICHA=MAM - Relatorios Ambientais
    xC_IDDOCMAN=TRADocID=157
    xC_IDANEXODOCMAN=TRAFileID=33
    xC_DESTINOINICIAL=Tractebel
    xC_ORIGEM=Neotropical
    xC_FORMATODOCUMENTO=Digital
    xC_GENERODOCUMENTO=
    xC_DOCPRINCIPAL=Sim
    @end
    <<EOD>>
    5 - So, when we use this batch file on ODC, the file (or image) will be converted, all metadata attached and then sent to UCM.
    But we don't know how to do the link between ODC and UCM. The Oracle Support says it is necessary to do some customization. In the books I could not find any info about how to do, just generic information or how to use ODC.
    Is there a way (without customization) to do that? Can anyone give us a step-by-step guide?
    Thanks for all help and guidance.
    Fernando

    What is the one-sentence requirement or issue you're trying to solve?
    If you only want content to be converted to pdf, then you should already have that with your items checked into UCM (if you have IBR enabled).
    if you really want to feed content into ODC using a batchfile, my first thought would be to create a transformation utility/app that will convert your batchfiles to the expected ODC import server folder job format. then you'll have to move or map the content to match.
    Again, without knowing the exact issue/business requirement you're trying to work through, I'd say a redesign of your ingestion process may be in order.
    If you feed content directly into ODC through any supported ODC method (watch folder, email, scanner, fax, etc), then you'll be able to use everything ootb as you'll be able to auto-commit directly into UCM or add an indexing step and manual commit to UCM.
    ODC is basically a front end for indexing and extra ingestion options to your content repo.
    IPM is basically the same, but it includes some extra process-related details (process metadata, process integrations/bpel/bpm, other system integrations/ebs/crm, etc). I don't feel that IPM would help with the transformation-specific question you've put out there.
    -ryan

  • How to delete string or line from unix file(dataset) of application server

    Hi  All,
    After transfer workarea information or all records into dataset(unix file). When I see the file in application server automatically the last line is shown a blank line. I am not passing any blank line.
    I have tried for single record than also the file generates the last line(2nd line) also a blank line.
    When I m reading the dataset, it is not reading the last blank line but why it is showing the last blank line?
    How to delete string or line from unix file(dataset) of application server?
    Please give your comments to resolve this.
    Thanks
    Tirumula Rao Chinni

    Hi Rio,
    I faced similar kind of issue working with files on UNIX platform.
    The line is a line feed to remove it use
    DATA : lv_carr_linefd TYPE abap_cr_lf VALUE cl_abap_char_utilities=>cr_lf. 
      DATA : lv_carr_return TYPE char1,                                   
             lv_line_feed   TYPE char1.                                          
      lv_line_feed   = lv_carr_linefd(1).
      lv_carr_return = lv_carr_linefd+1(1).
    Note: IMP: The character in ' ' is not space but is a special
    character set by pressing ALT and +255 simultaneosly
      REPLACE ALL OCCURRENCES OF lv_line_feed IN l_string WITH ' '.
      REPLACE ALL OCCURRENCES OF lv_carr_return IN l_string WITH ' '.

  • How to execute a  .sql file from a batch file

    Hi all
    I've to take backup of a database weekly twice on every wednesday & Friday @ 5pm IST. I've written a hot backup script, which works every well.
    now i want to automate the script. ie i want this script to run on wednesday & friday @ 5pm without any human interfearance ie with out actually any1 executing this script.
    i created a batch file prod.bak with the following lines
    @echo off
    set oracle_sid=testdb
    set oracle_home=d:\oracle\ora92
    sqlplus /nolog
    connect sys as sysdba/oracletest@testdb
    this batch file when eexecuted connects me to sql prompt.
    Now i want to execute my backup script bkp.sql automatically when it is connected to sql prompt.
    (i tried with these lines in the above batch file...
    call bkp.sql---it just opens the bkp.sql file in notepad & displays the script
    start bkp.sql---same as call
    connect / as sysdba/pwd@[email protected] --- does not work simply remains a the sql prompt.
    At 17:00 /Every:w,f "d:\bkp.sql"---does not work simply remains at the sql promt.)
    Can any1 let me know what should i write in the batch file that will execute the bkp.sql file automatically after it gets connected to sql prompt. M using oracle 9i.
    I'll manage he time through windows utility of scheduling task.. Let me know how to execute the .sql file from a batch file.
    Thanks
    Tripti

    Try
    sqlplus "sys/oracletest as sysdba" @bpk.sql
    Working locally, and having set the ORACLE_SID, you don't need to specify the SqlNet alias (@testdb).
    Remember to put an exit at the end of the bpk.sql script.

  • How to delete Hyperion Planning member using ODI

    Hi All,
    Anyone know how to delete Hyperion Planning member using ODI? And how to update account type on Hyperion Planning Using ODI?
    e.g.:
    I have a member with account type Saved Assumption, and I need to change to Revenue, but it cannot change. But if I change to Expense, it can. So what's wrong with the mapping?
    This is my csv file for update a member on Hyperion Planning.
    Parent,Account,Default Alias,Operation,Data Storage,Two Pass Calculation,Account Type,Time Balance,Skip Value,Data Type,Exchange Rate Type,Use 445,Variance Reporting,Source Plan Type,Aggregation,Member Formula
    Account,Statistics,,Update,,,,,,,,,,,,
    Account,Meal,,Update,Store,,Expense,,,,,,,,,
    Account,Test1,,Update,Never Share,,Saved Assumption,Average,None,Non-currency,none,,,Consol,~,
    Account,Test2,,Update,Never Share,,Revenue,Average,None,Non-currency,none,,,Consol,~,
    Account,Test3,,Update,Never Share,,Saved Assumption,Average,None,Non-currency,none,,,Consol,~,
    Thanks in advance.
    Regards,
    Sumardi
    Edited by: Sumardi Wijaya on Mar 31, 2009 10:57 PM

    Hi,
    To delete a member you use the Operation column, the following values can be used.
    Update – This is the default and is used if not populated, it Add, updates, moves the member being loaded.
    Delete Level 0 - Deletes the member being loaded if it has no children
    Delete Idescendants –Deletes the member being loaded and all of its descendants.
    Delete Descendants –Deletes the descendants of the member being loaded, but does not delete the member itself.
    Does the member you trying to change to Revenue have a variance reporting set to "Expense" as it will need to be set to "Non Expense"
    Also in your interface you can add logging options in the IKM, this maybe will give a clearer indication where your problem lies.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Rman backup fails on windows when using batch file

    Hello Gurus ..
    I am trying to setup incremental backup on my windows OS based server using RMAN command in batch file. When I use batch file in OS scheduler it is working fine, when I am calling same batch file from my LOCAL desktop PC it throws errors as below.
    D:\> \\3.193.211.19\sgdba\rman\bkp_acressit.bat
    D:\>rman catalog rman/******@acressit target / cmd
    file=E:\sgdba\rman\bkp_arch.rcv log E:\sgdba\rman\sit_arch_rman_backup.log
    RMAN-00557: could not open MSGLOG "E:\sgdba\rman\sit_arch_rman_backup.log"
    Argument Value Description
    target quoted-string connect-string for target database
    catalog quoted-string connect-string for recovery catalog
    nocatalog none if specified, then no recovery catalog
    cmdfile quoted-string name of input command file
    log quoted-string name of output message log file
    trace quoted-string name of output debugging message log file
    append none if specified, log is opened in append mode
    debug optional-args activate debugging
    msgno none show RMAN-nnnn prefix for all messages
    send quoted-string send a command to the media manager
    pipe string building block for pipe names
    timeout integer number of seconds to wait for pipe input
    checksyntax none check the command file for syntax errors
    Both single and double quotes (' or ") are accepted for a quoted-string.
    Quotes are not required unless the string contains embedded white-space.
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00556: could not open CMDFILE "E:\sgdba\rman\bkp_arch.rcv"
    Contents of the batch file and RCV file as below:
    Batch File:
    rman catalog rman/*******@acressit target / cmdfile=E:\sgdba\rman\bkp_arch.rcv log E:\sgdba\rman\sit_arch_rman_backup.log
    RCV File:
    RUN {
    ALLOCATE CHANNEL ch1 TYPE
    DISK FORMAT 'E:\ORA_RMAN_BACKUP\ARCH_%d_%u_%s_%p';
    BACKUP ARCHIVELOG delete input;
    RELEASE CHANNEL ch1;
    EXIT;
    --------------------------xxxxxxxxxxxxxx------------------------
    * on my DB server I am login using my administrator account, on my PC I dont have admin account.
    * I have checked remote execution using local user as well as admin user.
    * I have checked the permission and my local ID & EVERYONE has all permission in that folder.
    Any help will be appriciated.
    Thanks & Regards
    Ashish

    Ashish wrote:
    hi Atil,
    u have guessed it correctly, I came to know that issue later I copy file on local PC and it works fine.
    Now I am working on netbackup server. I want to use the same script to initiate backup from netbackup server. Do you have any idea or any guidelines from you will appriciate.
    Thanks
    AshishAshish,
    Is it "symantec's netbackup"? I do not know that product and if it has an option to enter your own RMAN scripts. On the other hand, it should be able to create irman scripts according to your backup job definition.
    Regards
    Gokhan

  • Run Form using Batch file

    Hiii
    how can run a form using batch file (.bat) .. .
    ???

    i forget to say that am using Developer 10g R2 ...
    another question is what should i start when using the batch file other than the
    OC4J instance .....

  • How to delete the payroll result by batch? have any program to do this?

    Hi,
    how to delete the payroll result by batch? have any program to do this?

    With standard payroll deletion (PU01), SAP  will not allow payroll results to be deleted if it already reaches certain steps of payroll process (e.g. Pre-DME, DME); instead, you would have to do payroll a void or payroll reversal. This utility doens't check for that, and only delete payroll results based on the criteria given. This therefore could cause inconsistency in production if your payroll process already surpasses certain steps.
    Rgds.

  • How to execute a DOS PROGRAM as batch file  in java

    How to execute a DOS PROGRAM as batch file in java
    pls help me

    www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Problem on using batch file

    Hi,
    I have an application which reads data from a text and writes them to a database. I should use batch files in my project to work classes with double clicking on them. Java application reads path of the text file from a properties file. I used relative paths like that " ..\\data\\records.txt" for text file path . But my problem is that; when I run application normally it executes. But when I tried to run it from batch file placed build folder(under project folder) it does not work. Because it tries to find the data folder under the build folder. But data folder is under parent folder of build folder. My batch file code is like that :
    SET PATH=%JAVA_HOME%\bin;%PATH%
    SET LIB_PATH=..\lib
    SET CLASSPATH=%LIB_PATH%\mysql-connector-java-3.0.17-ga-bin.jar;..\bin;..\
    java.exe yega.timesheet.MainApplication ..\\configuration\\properties.props
    pause
    Which statements should I add(and where) to make this batch file search for data folder under its parent folder... Please help me.
    Thank you.

    Thanks Paul, but I tried to use cd before running program. I added "cd .." or "cd ..\" lines to batch file but they didn't work. I decided to use absolute path instead of using relative paths. I also found one more solution. I can put a properties file in build too. And define text path as " ..\\data\\records.txt " in this properties file.
    Also I need to use "\\" because "..\\configuration\\properties.props" is the input for args...

  • Call ggsci using batch file from windows- get error

    i create a script to use ggsci, start manager, extract and replicat.
    i have success doing this in my linux.
    here is one of my script : start_ext1.sh
    cd /u01/app/oracle/ggs
    ./ggsci <<EOF
    start manager
    start ext_s
    exit
    EOF
    clear
    i have an error when i do this using batch file from windows.
    here is the batch file :
    @echo off
    cd C:\putty
    plink.exe -ssh -2 -P 22 [email protected] -pw oracle "./start_ext1.sh"
    every time i try to enter ggsci when i run that batch file, i get this error :
    ./ggsci: error while loading shared libraries: libnnz10.so: cannot open shared object file: No such file or directory
    i didn't get this error when i run the script in linux.
    is there anybody can help me?
    thanks a lot!

    problem solved!
    add : . ./.bash_profile before enter ggsci.
    it's worked! :)

  • How to make Title same as File name using Batch?

    I will be having hundreds of PDFs each month that will need info in the Tile field in Document properties. We create our PDFs from Quark using Distiller. I have found an option in the Batch process in Acrobat for editing the Document properties. Is there something I can enter in the title field that would instruct it to pull the file name as the title? I compare this to using &File in Word when instructing it to include the file name in the header area. Anyone know of any way to do this? I have seen multiple posts to the Acrobat forum regarding similar issues, but none with any responses as to how to accomplish this. Any help would be greatly appreciated. Thanks!

    For this behaviour you're looking at a javascript ...
    For dumb population then use Batch Processing inside Acrobat ..
    Jon

  • How to delete a perticular node from xml file using java code

    Hii All,
    Now i am trying to delete a perticular node from xml file.Like...
    XML file:
    <Licence>
    <SERVER>
    <was id="1">1</was>
    <was id="2">2</was>
    </SERVER>
    </LICENCE>
    I am working in messaging service using JABBER framework with whiteboard facility.
    Here Some commands i have created to add,modify,delete nodes from xml file.They Are
    1.If u want to add a new node then.
    create Licence.SERVER <ss id="3">ddd</ss> lic.xml
    (here u want to add a new node called "ss" under Licence.SERVER.
    And lic.xml is tyhe xml file name where it was saved.
    2.If u want to delete a node(Suppose <was id="1">),then the command should be
    delete Licence.SERVER.was:id='"1" lic.xml
    A problem arises that here it find two was attributes.And it delete the last was attribute,not the requested node.
    PLEASE HELP ME IN SOLVING THIS CODE..
    ------------------------------------

    Looks like you clicked on "Post" before you pasted in the code you were talking about.

Maybe you are looking for

  • Can't attach files or photos after microsoft update to 8.1

    I have a HP Envy Desktop all in one computer which I purchased in April 2013 with Windows 8.  Recently my Microsoft automatic update added Windows 8.1.   When that occured it knocked my printer off and I reinstalled.  I use Outlook 2013  for email. 

  • URGENT PLEASE!!! Enter Password Final attempt

    Hi Can some one please help me, my son was playing with my mobile I tried putting the password now it is not working can someone please help I have very important information on my mobile now its asking for final attempt if I put in the pin it will e

  • Travel Time in Calendar With gmail

    Have a question, wondering if anyone else has the same experience. I have been using calendar with both iCloud and Gmail, on my iOS 8 iPad. The travel time in the calendar app is great but it only seems to work on the iCloud calendars, yet on my MacB

  • Problems with IE 11 after the installation of KB2919355

    Since the installation of update KB2919355 last night, my IE11 (and mail app and weather app) no longer go online althought the wireless and broadband are fine. Spotify appears to work. Any suggestions?

  • How to apply custom authentication in an application?

    Hi All, I have to create one application in which there is a dealership table..... which stores information about dealers. now i want to apply a custom authentication so that only a valid dealer according to the table data can login into the applicat