- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Checking contents of TAR file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2005 06:32 PM
10-12-2005 06:32 PM
I have a tar files when checked using -t option have no files in it. Is there a test to check if the tar file contains files or no files at all?
Maximum points to all correct replies.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2005 06:35 PM
10-12-2005 06:35 PM
Re: Checking contents of TAR file
also, # ll
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2005 06:37 PM
10-12-2005 06:37 PM
Re: Checking contents of TAR file
ziad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2005 06:38 PM
10-12-2005 06:38 PM
Re: Checking contents of TAR file
file "your_file"
tar -tvf "your_tar_file"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2005 06:44 PM
10-12-2005 06:44 PM
Re: Checking contents of TAR file
with tar -tvf filename u can see if there any files there
if no output comes then is nothing in the file
regards gga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2005 06:44 PM
10-12-2005 06:44 PM
Re: Checking contents of TAR file
# ll PPS1XX15_20051013-144204.tar
-rw------- 1 root sys 10240 Oct 13 14:42 PPS1XX15_20051013-144204.tar
# tar -tvf PPS1XX15_20051013-144204.tar
#
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2005 06:50 PM
10-12-2005 06:50 PM
Re: Checking contents of TAR file
What i am looking for is to test the tar file if it contains files. Actually am creating a script for checking if the existing tar files contains file in it, if it contains no file at all, it will be discarded or remove from my system.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2005 07:01 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2005 07:15 PM
10-12-2005 07:15 PM
Re: Checking contents of TAR file
Throws away empty tar files
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2005 07:36 PM
10-12-2005 07:36 PM
Re: Checking contents of TAR file
You can use the strings command also.
#!/sbin/sh
if [ `strings test.tar| grep ustar| wc -l` -le 1 -a `tar -tvf test.tar| egrep ".*/$"| wc -l` -eq `strings test.tar| grep ustar| wc -l` ]
then
echo "The tar file test.tar contains no files"
else
echo "The tar file test.tar contains some files"
fi
Thanks.