- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Delete Empty directories
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
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
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
тАО02-07-2007 08:20 PM
тАО02-07-2007 08:20 PM
Does anyone out there have a script which does a search and distroy for empty directories on your system?
The -empty option is not valid for "find" on HP-UX ;-(
tia
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-07-2007 08:31 PM
тАО02-07-2007 08:31 PM
Re: Delete Empty directories
Please try to use 'rmdir' - remove empty directories
rgds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-07-2007 08:39 PM
тАО02-07-2007 08:39 PM
Solutionplease see:
http://duramecho.com/ComputerPrograms/DeleteEmptyDirectories/index.html
You can try the Perl sulution on a TEST filesystem. Seemed to work for me !
Or download gnu find and use the -empty option.
Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33 on how to reward any useful answers given to your questions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-07-2007 09:04 PM
тАО02-07-2007 09:04 PM
Re: Delete Empty directories
bit slow at work here, so I put together this script. It may still need some fine tuning, so please test it first !
#!/usr/bin/sh
# Pull out a list of all directories
find . -depth -type d > /tmp/x.x
while read direc
do
# count the number of files in each directory
count=`ll -1a $direc | wc -l`
echo $direc $count
if [ $count -eq 3 ]
then
rmdir $direc
fi
done < /tmp/x.x
rm /tmp/x.x
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-07-2007 09:24 PM
тАО02-07-2007 09:24 PM
Re: Delete Empty directories
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-07-2007 09:26 PM
тАО02-07-2007 09:26 PM
Re: Delete Empty directories
find some-path -depth -type d -exec rmdir + 2>&1 | \
grep -v "rmdir.*Directory not empty"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-07-2007 09:32 PM
тАО02-07-2007 09:32 PM
Re: Delete Empty directories
The Perl script fits the bill perfectly.
perl -MFile::Find -e"finddepth(subrmdir},'.')"