How to delete log file after zipping in batch

    
    **please check my code ... and suggest any changes to be made ... i m able to zipp the logs but not able to delete those logs.........
        thanking you...
        this is my code....
        @echo off
        set zip="C:\Program Files\7-Zip\7z.exe"
        rem Findout Month, Year and Date
        FOR /F "tokens=1,2,3,4 delims=/ " %%A in ('Date /t') do set year=%%D
        FOR /F "tokens=1,2,3,4 delims=/ " %%A in ('Date /t') do set month=%%B
        FOR /F "tokens=1,2,3,4 delims=/ " %%A in ('Date /t') do set day=%%C
        rem Solve problem Year start and adding 0 in month
        if %month% EQU 01 (
        set month=12
        set /a year=%year%-1
        ) else (
        set /a month=%month%-1
        if %month% LSS 10 set month=0%month%
        rem Set file names for last month file.
        set lastmonthfiles=server.log.%year%-%month%-
        %zip% -tzip  a -y "%lastmonthfiles%.zip" %lastmonthfiles%*
        if exist %lastmonthfiles%.zip(
        DEL server.log.%year%-%month%-*
        ) else (
            echo file not found
            pause

Actually it is only the 7Z filemanager that can delete files using the "Move" command and the "Delete after archiving" option.
if EXIST %lastmonthfiles%.zip ( DEL server.log.%year%-%month%-* ) ELSE echo zip not found
¯\_(ツ)_/¯

Similar Messages

  • How to delete log files in ACS 3.3

    hi guys, does any 1 know how to delete log/accounting files (*.csv) in ACS 3.3 (software version under win2000 server)
    kindly let me know, coz i m not able to find any option that allows me to delete them

    Have you tried shutting down the ACS Service and moving / deleting the file in Windows 2000 Server.
    You have to turn on the ACS service after you have deleted the log file.

  • How to delete log files in wheel group

    Let me start by saying that I've never used the terminal mode on a mac before, and I know nothing about UNIX. But here's my problem:
    My MacBook Pro, running OS 10.6, began filling up its boot disk for no apparent reason. I ran Disk Inventory X and found that a group of files had just been created in a folder called "Private" that is in the wheel group, to which I do not have access (I understand that this is a root admin group used by OSX). These files include, among others, a log file that is 20GB and was just created today. Since I can't access this folder as a normal user, how do I delete these files, and how can stop this from continuing to fill up my disk?

    Open the Console in the /Applications/Utilities/ folder and look at the various log files for an entry or group of entries which is repeated many times. When done, choose Go to Folder from the Finder's Go menu, provide /private/var/log/ as the path, and delete the files as you would any other.
    (60027)

  • How to delete .pdf file after viewing in SAP

    Hi,
    I've a program to show a pdf file within a SAP window using the open document method form the class cl_gui_pdfviewer. Now I want to delete the pdf file once I choose the back button or exit the program. How can I do that.
    In the PAI for the screen showing the pdf file, I have a case statement to perform the following
      When 'EXIT'
         call method my_pdf_viewer->close_document.
            .....    <--- some coding to try deleting the pdf file
         leave program.
    endcase.
    It seems that the pdf file is still in use by the program and cannot be deleted before leaving the program. Please help.
    Thanks in advance,
    Francis

    Hi All,
    I have had this issue and have finally resolved it.  Here's how:
    you need to destroy your custom container and html viewer control AND flush the front end cache.  This releases the lock on the file and lets you then delete it.
    Here's an example code:
    When 'EXIT'
    call method my_pdf_viewer->close_document.
      CALL METHOD my_pdf_viewer->FREE
        EXCEPTIONS
          CNTL_ERROR        = 1
          CNTL_SYSTEM_ERROR = 2
          others            = 3
      IF SY-SUBRC is initial.
        free my_pdf_viewer.
      ENDIF.
    this is the custom control parent container that contains the html control
      CALL METHOD MY_CONTAINER->FREE
         EXCEPTIONS
           CNTL_ERROR        = 1
           CNTL_SYSTEM_ERROR = 2
           others            = 3
      IF SY-SUBRC is initial.
        free my_container.
      ENDIF.
      CALL METHOD cl_gui_cfw=>dispatch.
      CALL METHOD cl_gui_cfw=>flush
            EXCEPTIONS CNTL_SYSTEM_ERROR = 1
            CNTL_ERROR = 2.
    ... <---- Delete PDF file (Delete Dataset xxxxxx.pdf)
    leave program.
    endcase.
    The other issue brought up is probably a permission issue -- trying to read the file from the presentation server versus a mapped drive that the SAP backend can access.  I read pdf files from a shared drive that the SAP backend can read/write to and it picks it up and displays just fine.
    Cheers,
    Matt

  • D delete encrypted file after zipping done.

    Hi,
    i m developing backup project in which transffer doen through RMI
    and first we encrypt files and then zip it and send over network to server;
    Now what i have faced, is when zip is done , i can delete file inside local machine called (*.enc) files (encrypted files) which is directly stores at server, not at client side.
    but i cant delete file to be chosen as backup file.
    e.g. if i select abc.doc file as backup
    it will first encrypt to (abc.doc.enc) then zip it
    now i want to delete it from local machine abc.doc.enc.
    what the code...
    it wll delete original source file....... thts danger..
    Thanks
    give me solution
    ghanshyam

    In short: you can't delete a file.
    Did you close all accessing streams before deleting? Has something else a lock on the file?

  • How can I recover an involuntarily  deleted keynote file after trash?

    After 3 days of working in Keynote I moved several files to my new 250gb hard disk. Many files were moved to trash and deleted. My work in keynote was lost and I have tried everything to recover it. Can you help me with this..? Is there a trick to recover a deletd file from trash...? Is there a recover-data file in my computer..? Thanks
    Unease

    How can I recover an involuntarily deleted keynote file after cleaning trash ..?

  • How to view UCCX log-file after importing outbound contacts?

    Some contacts from the list of contacts weren't imported:
    «Contacts imported successfully File name rep-30.07.14_2.txt Number of contacts imported successfully:24 Duplicate records exists in the imported file and are discarded. Check the logs for more details.»
    How to look at a log file - rep-30.07.14_2.txt?

    Hi Reena
    I only want to know how to check log file. Our customer load csv-files and make many mistakes at files. Whether it is possible to look log to see all mistakes at once?

  • Adobe 9.5 deletes log files - need to turn off creation of log files

    We have a bunch of files from SAS outputs that include a .sas, .rtf, .log extensions.
    When we try to convert a batch of the .rtf files to PDF by right clicking on them, the .log files are deleted. The originals are not Adobe .log files, but required files from the SAS output.
    I have unchecked "Delete Log Files for Successful jobs" in both Distiller and the Adobe printer preferences.
    It only deletes the .log with the same name as file types associated with Word. If I create .txt or xls files and .log files with the same name (i.e. test.txt and test.log) it does not delete the .log file, but it is overwritten by the Adobe log.
    This happens whether the file is local or on a mapped network drive.
    If I save to a different location, the .log is not deleted or overwritten, but that is really just a workaround. It's doable if it's the only option.
    They can also copy only the .rtf files to another folder and copy the .pdf files back after, but this is alot of extra work for high volumes
    This is an ongoing need involving lots of files, so moving or renaming is not an option, even with batch programs.
    What I really need to do is stop Adobe from creating AND deleting log files or force it to create the .log files in a different location than the original. Unless the problem is Word, but I cannot find any information on this problem.
    Thanks
    Mike

    Hi Shay,
    You are right, it would make perfect sense, however as you can see from the below forum, I was not able to solve this compilation issue..
    Oracle 10g Email Portlet - HELP PLEASE!!!
    (First post is the issue).
    If you have any ideas on how I could solve it, it would be great.
    Thanks
    Sam

  • In adf,how to delete a file generated on server,when the webpage is closed

    Hi,
    I have an application consisting of 2 pages. in the 1st page i will give some input details and when i click on submit, some java code is getting executed in the back. That java code generates a csv file in the server location. after succesful execution of java code, i was redirected to 2nd page. In 2nd page, i am giving option to download and when the user clicked on download button and after the file is downloaded -- in the backend i am deleting the file from the server. Till this point everything is fine. But if the user didnt click on the Download button and instead if he closes the browser, the csv file gets remained on the server itself. This is the issue i am facing .. I am not able to get an idea in ADF Framework, how to delete a file when the browser is closed. Please help me out in this.
    Thanks in advance !!!

    ADF has nothing to do with tracking browser close buttons. What you can do is call a JS function and call the method which deletes the file from within the JS function. ADF has a component for calling java code from JS call.

  • How to delete archivelog file at standby database

    Hi All,
    I'm running Physical Standby Database on ASM. At standby database, I can see all logs using asmcmd:
    ASMCMD> ls
    thread_1_seq_14.330.625772527
    thread_1_seq_15.346.625772527
    thread_1_seq_16.329.625772527
    thread_1_seq_17.327.625772559
    thread_1_seq_18.324.625772599
    thread_1_seq_19.341.625772367
    thread_1_seq_2.325.625772329
    But when I run RMAN to delete all these archivelogs, its give me error:
    oradr:/u01/app/oracle$rman rcvcat rman/rman@rman target /
    Recovery Manager: Release 10.2.0.3.0 - Production on Thu Jun 28 13:50:41 2007
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    connected to target database: AIXDB (DBID=2438430915, not open)
    connected to recovery catalog database
    RMAN> delete archivelog all;
    Starting implicit crosscheck backup at 28-JUN-07:01:50:56
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of delete command at 06/28/2007 13:50:56
    RMAN-12010: automatic channel allocation initialization failed
    RMAN-06004: ORACLE error from recovery catalog database: RMAN-20001: target database not found in recovery catalog
    RMAN> register database;
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of register command at 06/28/2007 13:51:06
    RMAN-08040: full resync skipped, control file is not current or backup
    Even it is not registering it. So how to delete archivelog file at standby database.
    Thanks in Advance
    Rakesh

    This appears related to Bug 3298797 that was supposed to be fixed in 10.2.0.1. The workaround is to switch over to the standby, register the standby and then switch back.

  • IMP: How to Read LOG Files

    Hey Gurus,
       I want to read the log files after executing SE37 t-codes, I tried in sm21 but i didnt get any result.
       Can U tell me how to read the log files ??
       what is T-code for that? or i have change any settings???
      Thanking You,
        Regards
       J Sarathi

    Hi ,
    You can use these two FM for analysing the log ..
                   APPL_LOG_READ_INTERN
                   APPL_LOG_DISPLAY_INTERN
    Or You can create A Zprogram using this FM
    and check the changes using RSDEPEND

  • Question:  why isn't how to delete a file available.

    How come you have to search for the information on how to delete a file from Adobe Reader.   This should be in the instructions on how to use with how to download.  Does anyone agree?

    If it is a system file and even if the file is corrupted, it cannot be deleted.
    Try reinstalling phone software using Nokia suite if the phone supports Nokia suite and an USB port.
    -------------------If this post helped you, click on accept as solution.------------------
    -----------------------------Appreciate by clicking on white star.----------------------------

  • Anyone knows how to delete a file from a directory?????

    hi there
    anyone has any idea on how to delete a file from a directory? delete(String filename)? thank you.

    Hi,
    Check this link.
    Gives you an example code to show how to delete a file.
    http://examples.oreilly.com/jenut/Delete.java
    Hope this helps.
    Roopasri Vittal
    Developer Technical Support
    Sun Microsystems
    http://sun.com/developers/support

  • How to delete the file with space in name

    Hi
    I want to delete the file "test ex.txt" file.
    i run the following command in command prompt.i can delete the file successfully.
    /bin/rm -f /mnt/"test ex.txt"
    I want to run the command from java.So i am using the following code
    String cmd = "/bin/rm -f /mnt/\"test ex.txt\"";
         Runtime rt = Runtime.getRuntime();
    process = rt.exec(cmd);
    The file was not deleted.
    How to delete the file with space in name?
    Help me

    Use the form of exec that takes an array of command + args.
    arr[0] = "/bin/rm"
    arr[1] = "-f"
    arr[2] = "/home/me/some directory with spaces";Or use ProcessBuilder, which is the preferred replacement for Runtime.exec, and which Runtime.exec calls.

  • How to delete a file in Keynote Remote for iPhone4?

    Any one know how to delete a file in Keynote remote app for iPhone4? I uploaded a Keynote file from iDisk to my iphone and I can't delete the file. The file does not show up when I connect my phone to iTunes.
    I also cannot connect my Iphone to Keynote anymore because of this file.

    The file is actually in the Keynote app and not the Keynote remote app for iPhone.

Maybe you are looking for