bulk delete certain types of files in rar/zip archive

Page 1 of 4 123 ... LastLast

  1. Posts : 76
    Microsoft Windows 7 Home Premium 64-bit 7600 Multiprocessor Free
       #1

    bulk delete certain types of files in rar/zip archive


    i've got thousands of rar/zip files where each of them could have some types of files I don't want. for example, *.txt or *.html etc. I would like to know if there is any shortcut way to delete them all quickly? I don't want to do it one by one. I will go crazy
      My Computer


  2. Posts : 12,012
    Windows 7 Home Premium SP1, 64-bit
       #2

    Are they scattered all over your hard drive, or are they in a particular part of your directory tree?

    If the latter, I'd think you could do it from a command prompt.

    Have they been unzipped so the contents are viewable from a command prompt?
      My Computer


  3. Posts : 2,177
    Windows 8.1 Pro x64
       #3

    Hi,

    The below script should do the trick, you are best putting all your .rar files into a single folder and replace the bit i have marked <file_path_here> with the path to the folder with all the .rar's

    From Command Line
    Code:
    for %I in (<file_path_here>\*.rar) do "C:\Program Files\WinRAR\WinRAR.exe" d -ibck "%I" *.txt
    From Batch File
    Code:
    for %%I in (<file_path_here>\*.rar) do "C:\Program Files\WinRAR\WinRAR.exe" d -ibck "%%I" *.txt
    *** Important ***
    Create yourself a test folder with a copy of a couple of the .rars and do a small test against them first


    At the end of the script you will notice .txt, specify the file extension you want to remove there
    You can list multiple file extensions at once...
    Code:
    for %%I in (<file_path_here>\*.rar) do "C:\Program Files\WinRAR\WinRAR.exe" d -ibck "%%I" *.txt *.exe *.jpg
    Please advise if you need some assistance.

    Regards,
    Jamie
      My Computer


  4. Posts : 76
    Microsoft Windows 7 Home Premium 64-bit 7600 Multiprocessor Free
    Thread Starter
       #4

    ignatzatsonic said:
    Are they scattered all over your hard drive, or are they in a particular part of your directory tree?

    If the latter, I'd think you could do it from a command prompt.

    Have they been unzipped so the contents are viewable from a command prompt?
    hi

    it is not all over my hard drives. It is only a particular group of zip/rar files under certain directory that I want to have special treatment with them. I have a lot other zip/rar files that should not be altered in any way.

    Now I haven't extracted them all, but I can do so if it helps. I think extracting is easy.
    I only want to bulk delete all *.txt and *.html without doing it with my hand one by one.
      My Computer


  5. Posts : 76
    Microsoft Windows 7 Home Premium 64-bit 7600 Multiprocessor Free
    Thread Starter
       #5

    JDobbsy1987 said:
    Hi,

    The below script should do the trick, you are best putting all your .rar files into a single folder and replace the bit i have marked <file_path_here> with the path to the folder with all the .rar's

    From Command Line
    Code:
    for %I in (<file_path_here>\*.rar) do "C:\Program Files\WinRAR\WinRAR.exe" d -ibck "%I" *.txt
    From Batch File
    Code:
    for %%I in (<file_path_here>\*.rar) do "C:\Program Files\WinRAR\WinRAR.exe" d -ibck "%%I" *.txt
    *** Important ***
    Create yourself a test folder with a copy of a couple of the .rars and do a small test against them first


    At the end of the script you will notice .txt, specify the file extension you want to remove there
    You can list multiple file extensions at once...
    Code:
    for %%I in (<file_path_here>\*.rar) do "C:\Program Files\WinRAR\WinRAR.exe" d -ibck "%%I" *.txt *.exe *.jpg
    Please advise if you need some assistance.

    Regards,
    Jamie


    Sorry ,I don't have any experience dealing with code/script. I am just a computer 'user'.. I always used tools and software. It looks very complicated for me, but I am willing to learn and try.

    Can you teach me again in a 'for dummies' way??

    what is batch? what is command line? how to get there?
      My Computer


  6. Posts : 2,177
    Windows 8.1 Pro x64
       #6

    kenny1999 said:
    Sorry ,I don't have any experience dealing with code/script. I am just a computer 'user'.. I always used tools and software. It looks very complicated for me, but I am willing to learn and try.

    Can you teach me again in a 'for dummies' way??

    what is batch? what is command line? how to get there?
    No worries... Command Line / Batch Files allow you to automate tasks and with the right script can do a series of tasks much quicker than you could manually.

    1. You said you only want to do a particular group of .rars... please create a copy of them in a new folder (maybe on your desktop?) i say create a copy so if anything goes wrong you still have the original copy.

    2. Now you have created a copy of the .rar files, where have you stored them? (i.e c:\users\kenny\desktop\rar)

    3. What file extensions would you like to delete?

    Cheers,
    Jamie
      My Computer


  7. Posts : 12,012
    Windows 7 Home Premium SP1, 64-bit
       #7

    kenny1999 said:
    ignatzatsonic said:
    Are they scattered all over your hard drive, or are they in a particular part of your directory tree?

    If the latter, I'd think you could do it from a command prompt.

    Have they been unzipped so the contents are viewable from a command prompt?
    hi

    it is not all over my hard drives. It is only a particular group of zip/rar files under certain directory that I want to have special treatment with them. I have a lot other zip/rar files that should not be altered in any way.

    Now I haven't extracted them all, but I can do so if it helps. I think extracting is easy.
    I only want to bulk delete all *.txt and *.html without doing it with my hand one by one.
    If they were all extracted and in folders underneath a folder called "stuff" on the C drive, such as C:\stuff\cat and C:\stuff\dog and C:\stuff\fish, you could use this command to get rid of all files with a txt extension.

    First, you would open a command prompt and navigate to C:\stuff. This would be your "certain directory" that you mentioned.

    Once you have navigated to the correct location, this would be the command to delete all .txt files:

    del /s *.txt

    After that completes, you would enter this command to get rid of all .html files

    del /s *.html


    And so on for other file types.

    Be careful. The command isn't forgiving. You have to be at the correct location (your "certain directory") before you execute the command.

    Are you even familiar with a command prompt?
      My Computer


  8. Posts : 76
    Microsoft Windows 7 Home Premium 64-bit 7600 Multiprocessor Free
    Thread Starter
       #8

    JDobbsy1987 said:
    kenny1999 said:
    Sorry ,I don't have any experience dealing with code/script. I am just a computer 'user'.. I always used tools and software. It looks very complicated for me, but I am willing to learn and try.

    Can you teach me again in a 'for dummies' way??

    what is batch? what is command line? how to get there?
    No worries... Command Line / Batch Files allow you to automate tasks and with the right script can do a series of tasks much quicker than you could manually.

    1. You said you only want to do a particular group of .rars... please create a copy of them in a new folder (maybe on your desktop?) i say create a copy so if anything goes wrong you still have the original copy.

    2. Now you have created a copy of the .rar files, where have you stored them? (i.e c:\users\kenny\desktop\rar)

    3. What file extensions would you like to delete?

    Cheers,
    Jamie

    hey, sorry just back from world cup TV

    1. Yes, I know It's important to make copies. They are in my G: drive. um, let me sort them first.

    2. let say G:\zip_rar_copy\

    3. yes, there are 400 files, either zip or rar. In each zip and rar there are some *.txt that I want to delete them. Do I have to extract all the zip first?? Can I avoid this?
      My Computer


  9. Posts : 76
    Microsoft Windows 7 Home Premium 64-bit 7600 Multiprocessor Free
    Thread Starter
       #9

    ignatzatsonic said:
    kenny1999 said:
    ignatzatsonic said:
    Are they scattered all over your hard drive, or are they in a particular part of your directory tree?

    If the latter, I'd think you could do it from a command prompt.

    Have they been unzipped so the contents are viewable from a command prompt?
    hi

    it is not all over my hard drives. It is only a particular group of zip/rar files under certain directory that I want to have special treatment with them. I have a lot other zip/rar files that should not be altered in any way.

    Now I haven't extracted them all, but I can do so if it helps. I think extracting is easy.
    I only want to bulk delete all *.txt and *.html without doing it with my hand one by one.
    If they were all extracted and in folders underneath a folder called "stuff" on the C drive, such as C:\stuff\cat and C:\stuff\dog and C:\stuff\fish, you could use this command to get rid of all files with a txt extension.

    First, you would open a command prompt and navigate to C:\stuff. This would be your "certain directory" that you mentioned.

    Once you have navigated to the correct location, this would be the command to delete all .txt files:

    del /s *.txt

    After that completes, you would enter this command to get rid of all .html files

    del /s *.html


    And so on for other file types.

    Be careful. The command isn't forgiving. You have to be at the correct location (your "certain directory") before you execute the command.

    Are you even familiar with a command prompt?
    how to open command prompt? start > cmd ????
      My Computer


  10. Posts : 2,177
    Windows 8.1 Pro x64
       #10

    The script i posted that we will run will remove the specified file type(s) from the .rar file so don't extract them.

    I'm not sure if this will work against .zip file though... let me do a quick test
      My Computer


 
Page 1 of 4 123 ... LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 00:13.
Find Us