LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-28-2009, 08:06 AM   #1
bunsenstraat
LQ Newbie
 
Registered: Mar 2009
Posts: 1

Rep: Reputation: 0
delete files from tar using wildcards


Hi,

The problem is this: I have a 32 GB tar.gz file on a server and just about
600 mb of disk space left. The archive contains backups but also a lot( really a lot ) of mp3 files which can be removed from the archive. How do I use the delete command in TAR to remove all mp3's without knowing the names ( there's just too many ).

Thanks,
bunsenstraat.
 
Old 03-28-2009, 08:48 AM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
--wildcards?
 
Old 03-28-2009, 10:21 AM   #3
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,669

Rep: Reputation: 498Reputation: 498Reputation: 498Reputation: 498Reputation: 498
bunsenstraat:

So far I have not yet known any other way than "specifying" particular names of archive members to be deleted therefrom. I hope others can give you the fitting answer. I suppose you have known already the usual way of deleting files from inside archive, which have the following conditions:

--You must be in the same folder where the archive is located
--Better you be a root to avoid unwanted returns
--You must have write permission on the folder disk space

then issue the usual command:

# tar --delete --file='archive_name.tar' file1 file2 file3 file4 file5
<file1-file5 are lists of files you want to delete>

As this procedure moves deleted files into the trashcan you must subsequently clean the trashcan in order to gain space for another tar deleting.

You may get list of archive contents using --list switch on tar.

Warning:

'tar --delete..' has reputation of often corrupting the archive if command is not properly handled. So be careful.

Hope this can help.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Use wget to download multiple files with wildcards Anant Khaitan Linux - Networking 8 08-23-2013 09:45 PM
a tough question 4 u, problem in extracting tar & tar.gz files p_garg Linux - General 5 11-08-2010 11:02 AM
Delete files script using Find and Tar Zypher123 Red Hat 1 12-12-2008 09:45 AM
tar wildcards doesnt work sleith Linux - Newbie 1 11-19-2008 09:55 PM
Best way to process a group of files (whole directory, wildcards etc.) garrettderner Linux - Newbie 11 07-31-2008 08:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration