- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- tar command seems to only bundle-up the last file ...
Operating System - Linux
1752806
Members
6143
Online
108789
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
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
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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-06-2008 01:44 AM
тАО10-06-2008 01:44 AM
Hi,
I'm attempting to bundle-up approximately 70+ files into a tar bundle by using the find command.
Although the files are seen to be bundled up in the tar-bundle, in fact, they aren't.
The tar -tvf.tar shows that there is only file in the bundle and apparently it's the last file in the directory to be bundled.
bash-2.05$ find . -depth -type f -size 0 -exec tar -cvf zero-sized.tar {} \;
a ./002/008/aOFS_BSM_P02000000 0K
a ./002/008/aOFS_OMU_P02000000 0K
a ./002/008/aOFS_TMU_P02000000 0K
a ./002/008/aOFS_CC_P02000000 0K
a ./002/008/aOFS_BSC3GCEM_P02000000 0K
a ./002/008/aOFS_TCU3GCEM_P02000000 0K
a ./002/008/aOFS_BSC3GPCMPORT_P02000000 0K
a ./002/008/aOFS_TCU3GPCMPORT_P02000000 0K
a ./002/008/aOFS_BSM_P02000100 0K
a ./002/008/aOFS_OMU_P02000100 0K
a ./002/008/aOFS_TMU_P02000100 0K
a ./002/008/aOFS_CC_P02000100 0K
a ./002/008/aOFS_BSC3GCEM_P02000000 0K
a ./002/008/aOFS_TCU3GCEM_P02000000 0K
a ./002/008/aOFS_BSC3GPCMPORT_P02000000 0K
a ./002/008/aOFS_TCU3GPCMPORT_P02000000 0K
a ./002/008/aOFS_BSM_P02000100 0K
a ./002/008/aOFS_OMU_P02000100 0K
a ./002/008/aOFS_TMU_P02000100 0K
a ./002/008/aOFS_CC_P02000100 0K
a ./002/008/aOFS_BSC3GCEM_P02000100 0K
a ./002/008/aOFS_TCU3GCEM_P02000100 0K
a ./002/008/aOFS_BSC3GPCMPORT_P02000100 0K
a ./002/008/aOFS_TCU3GPCMPORT_P02000100 0K
a ./002/008/aOFS_BSM_P02000200 0K
a ./002/008/aOFS_OMU_P02000200 0K
a ./002/008/aOFS_TMU_P02000200 0K
a ./002/008/aOFS_CC_P02000200 0K
a ./002/008/aOFS_BSC3GCEM_P02000200 0K
a ./002/008/aOFS_TCU3GCEM_P02000200 0K
a ./002/008/aOFS_BSC3GPCMPORT_P02000200 0K
a ./002/008/aOFS_TCU3GPCMPORT_P02000200 0K
a ./002/008/aOFS_BSM_P02000300 0K
a ./002/008/aOFS_OMU_P02000300 0K
a ./002/008/aOFS_TMU_P02000300 0K
a ./002/008/aOFS_CC_P02000300 0K
a ./002/008/aOFS_BSC3GCEM_P02000300 0K
a ./002/008/aOFS_TCU3GCEM_P02000300 0K
a ./002/008/aOFS_BSC3GPCMPORT_P02000300 0K
a ./002/008/aOFS_TCU3GPCMPORT_P02000300 0K
a ./002/008/aOFS_BSM_P02000400 0K
a ./002/008/aOFS_OMU_P02000400 0K
a ./002/008/aOFS_TMU_P02000400 0K
a ./002/008/aOFS_CC_P02000400 0K
a ./002/008/aOFS_BSC3GCEM_P02000400 0K
a ./002/008/aOFS_TCU3GCEM_P02000400 0K
a ./002/008/aOFS_BSC3GPCMPORT_P02000400 0K
a ./002/008/aOFS_TCU3GPCMPORT_P02000400 0K
a ./002/008/aOFS_BSM_P02000500 0K
a ./002/008/aOFS_OMU_P02000500 0K
a ./002/008/aOFS_TMU_P02000500 0K
a ./002/008/aOFS_CC_P02000500 0K
a ./002/008/aOFS_BSC3GCEM_P02000500 0K
a ./002/008/aOFS_TCU3GCEM_P02000500 0K
a ./002/008/aOFS_BSC3GPCMPORT_P02000500 0K
a ./002/008/aOFS_TCU3GPCMPORT_P02000500 0K
a ./002/008/aOFS_BSM_P02000600 0K
a ./002/008/aOFS_OMU_P02000600 0K
a ./002/008/aOFS_TMU_P02000600 0K
a ./002/008/aOFS_CC_P02000600 0K
a ./002/008/aOFS_BSC3GCEM_P02000600 0K
a ./002/008/aOFS_TCU3GCEM_P02000600 0K
a ./002/008/aOFS_BSC3GPCMPORT_P02000600 0K
a ./002/008/aOFS_TCU3GPCMPORT_P02000600 0K
a ./002/008/aOFS_BSM_P02000700 0K
a ./002/008/aOFS_OMU_P02000700 0K
a ./002/008/aOFS_TMU_P02000700 0K
a ./002/008/aOFS_CC_P02000700 0K
a ./002/008/aOFS_BSC3GCEM_P02000700 0K
a ./002/008/aOFS_TCU3GCEM_P02000700 0K
a ./002/008/aOFS_BSC3GPCMPORT_P02000700 0K
a ./002/008/aOFS_TCU3GPCMPORT_P02000700 0K
a ./002/008/aOFS_BSM_P02000800 0K
bash-2.05$ tar -tvf zero-sized.tar
tar: blocksize = 3
-rw-r----- 5041/111 0 Oct 6 10:05 2008 ./zero-sized/aOFS_TCU3GPCMPORT_P02000700
bash-2.05$ df -k .
Filesystem kbytes used avail capacity Mounted on
klstor01:/datavol/prodkl
47185920 43803530 3239390 94% /nfs/kl/prodkl
bash-2.05$
Note that the disk usage has not even reached 100% yet.
Could anyone help out with this issue?
Thanks
Danny.
I'm attempting to bundle-up approximately 70+ files into a tar bundle by using the find command.
Although the files are seen to be bundled up in the tar-bundle, in fact, they aren't.
The tar -tvf
bash-2.05$ find . -depth -type f -size 0 -exec tar -cvf zero-sized.tar {} \;
a ./002/008/aOFS_BSM_P02000000 0K
a ./002/008/aOFS_OMU_P02000000 0K
a ./002/008/aOFS_TMU_P02000000 0K
a ./002/008/aOFS_CC_P02000000 0K
a ./002/008/aOFS_BSC3GCEM_P02000000 0K
a ./002/008/aOFS_TCU3GCEM_P02000000 0K
a ./002/008/aOFS_BSC3GPCMPORT_P02000000 0K
a ./002/008/aOFS_TCU3GPCMPORT_P02000000 0K
a ./002/008/aOFS_BSM_P02000100 0K
a ./002/008/aOFS_OMU_P02000100 0K
a ./002/008/aOFS_TMU_P02000100 0K
a ./002/008/aOFS_CC_P02000100 0K
a ./002/008/aOFS_BSC3GCEM_P02000000 0K
a ./002/008/aOFS_TCU3GCEM_P02000000 0K
a ./002/008/aOFS_BSC3GPCMPORT_P02000000 0K
a ./002/008/aOFS_TCU3GPCMPORT_P02000000 0K
a ./002/008/aOFS_BSM_P02000100 0K
a ./002/008/aOFS_OMU_P02000100 0K
a ./002/008/aOFS_TMU_P02000100 0K
a ./002/008/aOFS_CC_P02000100 0K
a ./002/008/aOFS_BSC3GCEM_P02000100 0K
a ./002/008/aOFS_TCU3GCEM_P02000100 0K
a ./002/008/aOFS_BSC3GPCMPORT_P02000100 0K
a ./002/008/aOFS_TCU3GPCMPORT_P02000100 0K
a ./002/008/aOFS_BSM_P02000200 0K
a ./002/008/aOFS_OMU_P02000200 0K
a ./002/008/aOFS_TMU_P02000200 0K
a ./002/008/aOFS_CC_P02000200 0K
a ./002/008/aOFS_BSC3GCEM_P02000200 0K
a ./002/008/aOFS_TCU3GCEM_P02000200 0K
a ./002/008/aOFS_BSC3GPCMPORT_P02000200 0K
a ./002/008/aOFS_TCU3GPCMPORT_P02000200 0K
a ./002/008/aOFS_BSM_P02000300 0K
a ./002/008/aOFS_OMU_P02000300 0K
a ./002/008/aOFS_TMU_P02000300 0K
a ./002/008/aOFS_CC_P02000300 0K
a ./002/008/aOFS_BSC3GCEM_P02000300 0K
a ./002/008/aOFS_TCU3GCEM_P02000300 0K
a ./002/008/aOFS_BSC3GPCMPORT_P02000300 0K
a ./002/008/aOFS_TCU3GPCMPORT_P02000300 0K
a ./002/008/aOFS_BSM_P02000400 0K
a ./002/008/aOFS_OMU_P02000400 0K
a ./002/008/aOFS_TMU_P02000400 0K
a ./002/008/aOFS_CC_P02000400 0K
a ./002/008/aOFS_BSC3GCEM_P02000400 0K
a ./002/008/aOFS_TCU3GCEM_P02000400 0K
a ./002/008/aOFS_BSC3GPCMPORT_P02000400 0K
a ./002/008/aOFS_TCU3GPCMPORT_P02000400 0K
a ./002/008/aOFS_BSM_P02000500 0K
a ./002/008/aOFS_OMU_P02000500 0K
a ./002/008/aOFS_TMU_P02000500 0K
a ./002/008/aOFS_CC_P02000500 0K
a ./002/008/aOFS_BSC3GCEM_P02000500 0K
a ./002/008/aOFS_TCU3GCEM_P02000500 0K
a ./002/008/aOFS_BSC3GPCMPORT_P02000500 0K
a ./002/008/aOFS_TCU3GPCMPORT_P02000500 0K
a ./002/008/aOFS_BSM_P02000600 0K
a ./002/008/aOFS_OMU_P02000600 0K
a ./002/008/aOFS_TMU_P02000600 0K
a ./002/008/aOFS_CC_P02000600 0K
a ./002/008/aOFS_BSC3GCEM_P02000600 0K
a ./002/008/aOFS_TCU3GCEM_P02000600 0K
a ./002/008/aOFS_BSC3GPCMPORT_P02000600 0K
a ./002/008/aOFS_TCU3GPCMPORT_P02000600 0K
a ./002/008/aOFS_BSM_P02000700 0K
a ./002/008/aOFS_OMU_P02000700 0K
a ./002/008/aOFS_TMU_P02000700 0K
a ./002/008/aOFS_CC_P02000700 0K
a ./002/008/aOFS_BSC3GCEM_P02000700 0K
a ./002/008/aOFS_TCU3GCEM_P02000700 0K
a ./002/008/aOFS_BSC3GPCMPORT_P02000700 0K
a ./002/008/aOFS_TCU3GPCMPORT_P02000700 0K
a ./002/008/aOFS_BSM_P02000800 0K
bash-2.05$ tar -tvf zero-sized.tar
tar: blocksize = 3
-rw-r----- 5041/111 0 Oct 6 10:05 2008 ./zero-sized/aOFS_TCU3GPCMPORT_P02000700
bash-2.05$ df -k .
Filesystem kbytes used avail capacity Mounted on
klstor01:/datavol/prodkl
47185920 43803530 3239390 94% /nfs/kl/prodkl
bash-2.05$
Note that the disk usage has not even reached 100% yet.
Could anyone help out with this issue?
Thanks
Danny.
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-06-2008 04:08 AM
тАО10-06-2008 04:08 AM
Solution
You are replacing your tar file at each tar command, so, having only the last file on it is normal.
You should use the concatenate (-A) option instead of the create (-c) option.
You may change your command also as below:
tar cvf zero-sized.tar $(find . -depth -type f -size 0 )
You should use the concatenate (-A) option instead of the create (-c) option.
You may change your command also as below:
tar cvf zero-sized.tar $(find . -depth -type f -size 0 )
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-06-2008 05:51 AM
тАО10-06-2008 05:51 AM
Re: tar command seems to only bundle-up the last file in the list when used with find.
Hi Danny,
You may also replace the \; to \+ in your find-command. This prevents also executing tar for each file by cumulating occurances of {}.
Thus:
$ find . -depth -type f -size 0 -exec tar -cvf zero-sized.tar {} \+
see find(1) about parameter -exec
rgds
HGH
You may also replace the \; to \+ in your find-command. This prevents also executing tar for each file by cumulating occurances of {}.
Thus:
$ find . -depth -type f -size 0 -exec tar -cvf zero-sized.tar {} \+
see find(1) about parameter -exec
rgds
HGH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-06-2008 07:53 AM
тАО10-06-2008 07:53 AM
Re: tar command seems to only bundle-up the last file in the list when used with find.
If we assume that you're in the right forum
(Linux), then your "tar" should be GNU "tar", and GNU "tar" offers some useful options,
like "--files-from=- or -T -", which causes
it to read from standard input a list of
files to process. You could simply pipe the
output from your "find" command into a single
"tar" command using this technique.
http://www.gnu.org/software/tar/manual/tar.html#SEC101
> see find(1) about parameter -exec
"man find" could be informative, too, if
it's still not clear why your original
command failed.
(Linux), then your "tar" should be GNU "tar", and GNU "tar" offers some useful options,
like "--files-from=- or -T -", which causes
it to read from standard input a list of
files to process. You could simply pipe the
output from your "find" command into a single
"tar" command using this technique.
http://www.gnu.org/software/tar/manual/tar.html#SEC101
> see find(1) about parameter -exec
"man find" could be informative, too, if
it's still not clear why your original
command failed.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP