- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- find command to delete zero files
Operating System - HP-UX
1752796
Members
5827
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
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
тАО09-30-2009 02:13 PM
тАО09-30-2009 02:13 PM
find command to delete zero files
Hello,
I need to find zero bytes files and delete them (as part of the script).
I know i can use find . -type f -exec rm {}\; but the issue is it will delete all files under it and the directories below it. I do not want to go below the current directory.
Thanks ina advance.
I need to find zero bytes files and delete them (as part of the script).
I know i can use find . -type f -exec rm {}\; but the issue is it will delete all files under it and the directories below it. I do not want to go below the current directory.
Thanks ina advance.
- Tags:
- find
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-30-2009 02:33 PM
тАО09-30-2009 02:33 PM
Re: find command to delete zero files
Many "find" examples on this Forum.
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1276654
> [...] it will delete all files [...]
It sure will. "man find", look for "-size".
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1276654
> [...] it will delete all files [...]
It sure will. "man find", look for "-size".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-30-2009 02:59 PM
тАО09-30-2009 02:59 PM
Re: find command to delete zero files
Hi:
# cd /path
# find . -type d ! -name . -prune -o -type f -size 0 -exec rm {} +
Verify that this gives you what you want by first substituting 'echo' for 'rm'.
Regards!
...JRF...
# cd /path
# find . -type d ! -name . -prune -o -type f -size 0 -exec rm {} +
Verify that this gives you what you want by first substituting 'echo' for 'rm'.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-30-2009 11:05 PM
тАО09-30-2009 11:05 PM
Re: find command to delete zero files
But remember, some applications are creating lock files with a size of zero too. Deleting them may harm your system!
Hope this helps!
Regards
Torsten.
__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.
__________________________________________________
No support by private messages. Please ask the forum!
If you feel this was helpful please click the KUDOS! thumb below!
Hope this helps!
Regards
Torsten.
__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.
__________________________________________________
No support by private messages. Please ask the forum!
If you feel this was helpful please click the KUDOS! thumb below!
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