Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: delet (.rar .zip ) files after successfully unzip  (Read 18520 times)

0 Members and 1 Guest are viewing this topic.

Reno



    Hopeful
  • Thanked: 32
    Re: delet (.rar .zip ) files after successfully unzip
    « Reply #15 on: June 03, 2009, 01:30:15 AM »
    type '.zip.exe' at command prompt:
    it should display something as follow:
    Code: [Select]
    D:\batch>.zip

    7-Zip 4.57  Copyright (c) 1999-2007 Igor Pavlov  2007-12-06

    Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
           [<@listfiles...>]

    mioo_sara

      Topic Starter


      Intermediate

      Re: delet (.rar .zip ) files after successfully unzip
      « Reply #16 on: June 03, 2009, 06:10:37 AM »
      hi  dear reno
      well  i  don't have 7zip  installed on  my  system  so  when  i typed .zip.exe in  CMD i  saw  error massage


      Quote
      Microsoft Windows XP [Version 5.1.2600]
      (C) Copyright 1985-2001 Microsoft Corp.

      C:\Documents and Settings\sss>.zip.exe
      '.zip.exe' is not recognized as an internal or external command,
      operable program or batch file.

      well  i did not navigate to my  folder through  CMD  ;D ;D
      but  i did something else that defined my   file is not bad !!
      i   copied .zip.exe in  a folder  and  typed .zip.exe in  a bat file and executed bat file
      you  can  see the result

      Quote
      F:\bbb\delet zip>.zip.exe

      7-Zip 4.62  Copyright (c) 1999-2008 Igor Pavlov  2008-12-02

      Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
             [<@listfiles...>]

      <Commands>
        a: Add files to archive
        b: Benchmark
        d: Delete files from archive
        e: Extract files from archive (without using directory names)
        l: List contents of archive
        t: Test integrity of archive
        u: Update files to archive
        x: eXtract files with full paths
      <Switches>
        -ai[r[-|0]]{@listfile|!wildcard}: Include archives
        -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives
        -bd: Disable percentage indicator
        -i[r[-|0]]{@listfile|!wildcard}: Include filenames
        -m{Parameters}: set compression Method
        -o{Directory}: set Output directory
        -p{Password}: set Password
        -r[-|0]: Recurse subdirectories
        -scs{UTF-8 | WIN | DOS}: set charset for list files
        -sfx[{name}]: Create SFX archive
        -si[{name}]: read data from stdin
        -slt: show technical information for l (List) command
        -so: write data to stdout
        -ssc[-]: set sensitive case mode
        -ssw: compress shared files
        -t{Type}: Set type of archive
        -v{Size}[b|k|m|g]: Create volumes
        -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options
        -w[{path}]: assign Work directory. Empty path means a temporary directory
        -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames
        -y: assume Yes on all queries

      so  my  file is a command version  right RENO?
      now what's wrong?  would you  please read my  previous post again?
      thanks

      Reno



        Hopeful
      • Thanked: 32
        Re: delet (.rar .zip ) files after successfully unzip
        « Reply #17 on: June 03, 2009, 07:17:32 AM »
        admitted it that i dont have an answer for this.
        i have used that batch script for months, and works well as i intend it to.

        change echo off to echo on, then if you could post some screen output which line and file name goes wrong, i try my best to assist.

        mioo_sara

          Topic Starter


          Intermediate

          Re: delet (.rar .zip ) files after successfully unzip
          « Reply #18 on: June 03, 2009, 09:30:24 AM »
          hi  to  all  specially  my  dear RENO
          RENO you  were right !!  i had created 2 empty  folders and  compressed them..... because of that  program  could not extract anything
          i apologize for that i  did not saw that there are some switches in  your program
          ======================================================
          but now  i created 2 folders and put some files inside both  of them  and then  compressed them  to  names below
          my rar.rar
          my zip.zip
          and added (.zip.exe , .Rar.exe and reno.bat) and execute bat file it extracted all  files and folders and deleted my rar.rar file but my zip.zip is still  exist !! it's just hiden but not deleted
          below you  can  see the  result in a CMD window

          mioo_sara

            Topic Starter


            Intermediate

            Re: delet (.rar .zip ) files after successfully unzip
            « Reply #19 on: June 03, 2009, 09:31:01 AM »
            Quote
            C:\delet zip>for /F "tokens=*" %a in ('dir /b *.rar *.zip') do (%~xa e -y "%~a"
              && attrib +h "%~a" )

            C:\delet zip>(.rar e -y "my rar.rar"   && attrib +h "my rar.rar" )

            RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
            Shareware version         Type RAR -? for help


            Extracting from my rar.rar

            Extracting  New Rich Text Document.rtf                                OK
            All OK

            C:\delet zip>(.zip e -y "my zip.zip"   && attrib +h "my zip.zip" )

            7-Zip 4.62  Copyright (c) 1999-2008 Igor Pavlov  2008-12-02

            Processing archive: my zip.zip

            Extracting  my zip
            Extracting  my zip\New Text Document.txt

            Everything is Ok

            Folders: 1
            Files: 1
            Size:       10
            Compressed: 251

            C:\delet zip>for /F "tokens=*" %a in ('dir/b/ah *.zip *.rar') do (for /F "tokens
            =*" %b in ('%~xa lb "%a"') do (dir/b "%b"   1>nul 2>&1  && (del/a "%a"   && echo
             DELETE: %a ) ) )

            C:\delet zip>(for /F "tokens=*" %b in ('.zip lb "my zip.zip"') do (dir/b "%b"
            1>nul 2>&1  && (del/a "my zip.zip"   && echo DELETE: my zip.zip ) ) )

            C:\delet zip>(dir/b "7-Zip 4.62  Copyright (c) 1999-2008 Igor Pavlov  2008-12-02
            "   1>nul 2>&1  && (del/a "my zip.zip"   && echo DELETE: my zip.zip ) )

            C:\delet zip>(dir/b "Error:"   1>nul 2>&1  && (del/a "my zip.zip"   && echo DELE
            TE: my zip.zip ) )

            C:\delet zip>(dir/b "Incorrect command line"   1>nul 2>&1  && (del/a "my zip.zip
            "   && echo DELETE: my zip.zip ) )

            C:\delet zip>(for /F "tokens=*" %b in ('.rar lb "my rar.rar"') do (dir/b "%b"
            1>nul 2>&1  && (del/a "my rar.rar"   && echo DELETE: my rar.rar ) ) )

            C:\delet zip>(dir/b "New Rich Text Document.rtf"   1>nul 2>&1  && (del/a "my rar
            .rar"   && echo DELETE: my rar.rar ) )
            DELETE: my rar.rar

            C:\delet zip>(dir/b "my rar"   1>nul 2>&1  && (del/a "my rar.rar"   && echo DELE
            TE: my rar.rar ) )

            C:\delet zip>pause
            Press any key to continue . . .

            Reno



              Hopeful
            • Thanked: 32
              Re: delet (.rar .zip ) files after successfully unzip
              « Reply #20 on: June 03, 2009, 09:47:11 AM »
              i am speechless.
              the 2 batch file is not meant to be combined into one.

              instead use this:
              Code: [Select]
              @echo off

              for /f "tokens=*" %%a in ('dir /b *.rar *.zip') do (
              %%~xa e -y "%%~a" && del "%%~a"
              )
              pause

              there is a HUGE bug that need to be fix in _clean.bat at post #2, there is no 'lb' switch in 7z.exe. so don't use script at post#2. thank you for reporting a bug. ;)

              mioo_sara

                Topic Starter


                Intermediate

                Re: delet (.rar .zip ) files after successfully unzip
                « Reply #21 on: June 03, 2009, 02:53:34 PM »
                wow thanks RENO ;)
                what a powerful  script it's so  fast even  before i  start  it  it  finished !! :o  fantastic it's working like a charm it extract files and delet compressed files with  no error .  it is very  delightful  that this website has a programmer like you
                ==============================================
                now with  a test i have my  2 final  questions   that will  be very  greatful  if you  solve them

                how can  we replace (*.rar .*.zip) with our file names? i  don't want to  all  files to be extracted .just need those files that i order get extracted
                thanks can  you  give an  example for replacable file names (for both  zip and rar files at the same time)
                thanks ;)
                « Last Edit: June 07, 2009, 11:30:16 PM by mioo_sara »

                mioo_sara

                  Topic Starter


                  Intermediate

                  Re: delet (.rar .zip ) files after successfully unzip
                  « Reply #22 on: June 05, 2009, 06:25:35 AM »
                  has someone seen RENO around? :'(