- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Filesystem Maintenance script help
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
12-17-2002 03:54 AM
12-17-2002 03:54 AM
One of my many shortcomings in wanting to be a 'proper' sysadmin is that i cant script for toffee...in other words i need some help.
Problem.
I have 2 archive filesystems that i have to clear down after i have backed them up,
/psnarchive and /pfx archive.
I use the following commands to list the large files within the filesystems ans sub directories
find /pfxarchive -size +10000000c -exec ll {} \;|more
find /psnarchive -size +10000000c -exec ll {} \;|more
Then i go through the directories and remove the files manually.
I would like to automate this process into a script to save time.
Any ideas
Cheers
George
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2002 03:59 AM
12-17-2002 03:59 AM
Solution-exec rm -f {} \;
and it will find and remove in one go.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2002 04:02 AM
12-17-2002 04:02 AM
Re: Filesystem Maintenance script help
I may be too stupid to understand what you mean, but...
you've got it already! ;-)
find /pfxarchive -size +10000000c -exec rm {} \;
and
find /psnarchive -size +10000000c -exec rm {} \;
will remove automatically the files...
of course, if you've aliased rm to rm -i, may have to unalias it:
unalias rm
you could also use rm -f instead of rm, but that's a _bad_ idea if you're running the script as root ;-P
Cheers,
FiX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2002 04:05 AM
12-17-2002 04:05 AM
Re: Filesystem Maintenance script help
I think i've been on the stupid pills again :)
Thanks for the quick response.
George
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2002 04:50 AM
12-17-2002 04:50 AM
Re: Filesystem Maintenance script help
MOST IMPORTANT: find without the -type option will find everything (sockets, files, directories, links, device files, etc). Use -type f to limit the choices if these directories do (or may someday) contain directories. The rm command will fail to remove directories without the -r option, but this is a dangerous option for untested scripts.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2002 10:30 AM
12-17-2002 10:30 AM
Re: Filesystem Maintenance script help
for FILE in `find /pfxarchive -size +10000000c -exec ll {} \`
do
echo $FILE>>LOGFILE
rm $FILE
done
This isn't very efficient, it could probably be done within the find command all by itself. But this one is easy to write and maintain.
Good Luck
Chris