- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- the use of find command
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
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
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
03-16-2014 11:37 PM - last edited on 03-17-2014 02:47 AM by Maiko-I
03-16-2014 11:37 PM - last edited on 03-17-2014 02:47 AM by Maiko-I
the use of find command
Hi All!
I am using the find command to find files with a certain extension, and gzip them, like this:
find . -name '*.xml' -mtime +05 -exec gzip {} \;
but everytime it finds a file that is already compressed, produces the following output:
gzip:./BCH43273/SEQ0/BAL_TX5187.42135.xml.gz already exists; do you wish to overwrite (y or n)?
How skip or avoid this ?
P.S. This thread has been moevd from HP-UX > System Administration to HP-UX > languages. - Hp Forum Moderator
- Tags:
- find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2014 01:14 AM
03-17-2014 01:14 AM
Re: the use of find command
>every time it finds a file that is already compressed, produces the following output:
I can't see how that happens unless you have a directory ending in .xml?
Add "-type f" to your find.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2014 08:06 AM
03-17-2014 08:06 AM
Re: the use of find command
Hi!
the -type -f did not work.... I do not have a dir ending with .xml... is just files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2014 09:16 AM
03-17-2014 09:16 AM
Re: the use of find command
My guess is that you are finding a file named BAL_TX5187.42135.xml when your find is running. As a result of finding that file, gzip is running to compress. However, there is already a file named BAL_TX5187.42135.xml.gz so gzip is asking if you wish to overwrite what is already there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2014 07:31 PM
03-17-2014 07:31 PM
Re: the use of find command
>there is already a file named BAL_TX5187.42135.xml.gz
Because the last run aborted?
Looking at the times of the two files may help:
ll ./BCH43273/SEQ0/BAL_TX5187.42135.xml*
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2014 10:53 PM
03-17-2014 10:53 PM
Re: the use of find command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2014 10:56 PM
03-17-2014 10:56 PM
Re: the use of find command
yes there is :
ll ./BCH43273/SEQ0/BAL_TX5187.42135.xml* -rw-rw-rw- 1 bscsprod bscs 1666 Dec 15 21:15 ./BCH43273/SEQ0/BAL_TX5187.42135.xml -rw-r--r-- 1 bscsprod bscs 340 Sep 12 2013 ./BCH43273/SEQ0/BAL_TX5187.42135.xml.gz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2014 06:19 AM
03-18-2014 06:19 AM
Re: the use of find command
So you definitely have duplicate names. The .gz file from Sep. 12, 2013 and the regular file from Dec. 15, 2013, hence the question.
You cannot tell gzip to just skip the file.
The only option is to use 'gzip -f' which will overwrite the existin .gz file with the new one.
# gzip -?
gzip 1.3.5 (HP-UX fixlevel 1)
(2002-09-30)
usage: gzip [-cdfhlLnNrtvV19] [-S suffix] [file ...]
-c --stdout write on standard output, keep original files unchanged
-d --decompress decompress
-f --force force overwrite of output file and compress links
-h --help give this help
-l --list list compressed file contents
-L --license display software license
-n --no-name do not save or restore the original name and time stamp
-N --name save or restore the original name and time stamp
-q --quiet suppress all warnings
-r --recursive operate recursively on directories
-S .suf --suffix .suf use suffix .suf on compressed files
-t --test test compressed file integrity
-v --verbose verbose mode
-V --version display version number
-1 --fast compress faster
-9 --best compress better
file... files to (de)compress. If none given, use standard input.
Report bugs to <bug-gzip@gnu.org>.