Linux Delete Old files from Tar

Hi All,

Requirement:

I Have file.Tar.gz , I Need to Delete files from a tar , older than n days.
Without Extracting tar files to current directory, I need to Find out files using mtime, is it Possible ?

I don’t think so. The --delete option only works on given file names. There is no option to specify older than n days. Typical usage is as follow to get a list of files:

tar --list --file=myfiles.tar

Next delete foo and bar files

tar --delete --file=myfiles.tar filenamehere
tar --delete --file=myfiles.tar foo bar
tar --list --file=myfiles.tar
1 Like

Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki