Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: bulk delete certain types of files in rar/zip archive

08 Jul 2014   #1
kenny1999

Microsoft Windows 7 Home Premium 64-bit 7600 Multiprocessor Free
 
 
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 System SpecsSystem Spec
.
08 Jul 2014   #2
ignatzatsonic

Microsoft Community Contributor Award Recipient

Windows 7 Home Premium SP1, 64-bit
 
 

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 System SpecsSystem Spec
08 Jul 2014   #3
JDobbsy1987

Windows 8.1 Pro x64
 
 

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 System SpecsSystem Spec
.

08 Jul 2014   #4
kenny1999

Microsoft Windows 7 Home Premium 64-bit 7600 Multiprocessor Free
 
 

Quote   Quote: Originally Posted by ignatzatsonic View Post
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 System SpecsSystem Spec
08 Jul 2014   #5
kenny1999

Microsoft Windows 7 Home Premium 64-bit 7600 Multiprocessor Free
 
 

Quote   Quote: Originally Posted by JDobbsy1987 View Post
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 System SpecsSystem Spec
08 Jul 2014   #6
JDobbsy1987

Windows 8.1 Pro x64
 
 

Quote   Quote: Originally Posted by kenny1999 View Post
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 System SpecsSystem Spec
08 Jul 2014   #7
ignatzatsonic

Microsoft Community Contributor Award Recipient

Windows 7 Home Premium SP1, 64-bit
 
 

Quote   Quote: Originally Posted by kenny1999 View Post
Quote   Quote: Originally Posted by ignatzatsonic View Post
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 System SpecsSystem Spec
08 Jul 2014   #8
kenny1999

Microsoft Windows 7 Home Premium 64-bit 7600 Multiprocessor Free
 
 

Quote   Quote: Originally Posted by JDobbsy1987 View Post
Quote   Quote: Originally Posted by kenny1999 View Post
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 System SpecsSystem Spec
08 Jul 2014   #9
kenny1999

Microsoft Windows 7 Home Premium 64-bit 7600 Multiprocessor Free
 
 

Quote   Quote: Originally Posted by ignatzatsonic View Post
Quote   Quote: Originally Posted by kenny1999 View Post
Quote   Quote: Originally Posted by ignatzatsonic View Post
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 System SpecsSystem Spec
08 Jul 2014   #10
JDobbsy1987

Windows 8.1 Pro x64
 
 

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 System SpecsSystem Spec
Reply

 bulk delete certain types of files in rar/zip archive




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
How to add to RAR archive 40k files without using windows search.
I have over 40 thousand files I need to archive spread throughout a drive in different folders. I cannot use windows search because the drive cannot be index and will take quite some time to fix and solve. Is there another method that can allow me to search a drive and add to winrar .rar archive?...
General Discussion
BULK creating of folders based on file names, and then moving files in
Hi Everyone, i have been looking for weeks for a way to do this and i have tried so many applications but i just cant seem to get it right, i was hoping that you guys my be able to help me out here with this one.. i have two folders, at the moment with identical file names in the ( they...
General Discussion
Bulk delete parts of filenames?
I have a lot of files (songs) which names are of the following type: xxxx - yyyy Where x represents the artist's name and y represents the song's name. Now, I need a way to bulk edit these files so that everything left of the hyphen is removed and later on the hyphen itself so that the...
General Discussion
BSOD copying bulk files from ext. HDD
Hi all, I have a 1TB external HDD attached to my laptop. Whenever I attempt to copy multiple files to another HDD I am confronted with a BSOD. Can anyone read the dumpfile and see what my issue is, please? Thanks, Ed
BSOD Help and Support
removing damaged archive files?
Running win 7. Just scanned my C drive w/ESET and the scan turned up several damaged archived files (see below). Should I: 1. Delete the damaged archived files shown trusting that there won't be any repercussions later? 2. Leave everything as is and forget about it? 3. Any reason not to...
General Discussion
Windows 7 saving bulk files
I have received a link which has 50 jpg files in it. I opened the link and all the pictures are there. I clicked on select all and all files are highlighted and i clicked on save as but only one file is saved. Could you tell me, how can i save all of the 50 pictures to my pictures in bulk at...
General Discussion


Our Sites

Site Links

About Us

Find 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 18:41.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App