- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Error while deleting subdirectories & files.
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
02-17-2006 12:55 AM
02-17-2006 12:55 AM
Error while deleting subdirectories & files.
Why I am getting the error and what is the right command to deleted subdir as well?.
find . -type f -mtime +90 -exec rm {} \;
rm: ./PSAPPSRV.8861/cache directory
rm: ./PSAPPSRV.1138 directory
rm: ./PSAPPSRV.1138/cache directory
rm: ./PSAPPSRV.6822 directory
rm: ./PSAPPSRV.6822/cache directory
rm: ./PSAPPSRV.27391 directory
rm: ./PSAPPSRV.27391/cache directo
Thanks,
Gulam.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2006 01:00 AM
02-17-2006 01:00 AM
Re: Error while deleting subdirectories & files.
use -f option to rm (rm -f) and try .
Thanks,
bl.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2006 01:00 AM
02-17-2006 01:00 AM
Re: Error while deleting subdirectories & files.
find . -type f -mtime +90 -exec rm -Rf {} \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2006 01:03 AM
02-17-2006 01:03 AM
Re: Error while deleting subdirectories & files.
find . -type f -mtime +90 -exec rm {} \;
change rm to rm -Rf
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2006 01:04 AM
02-17-2006 01:04 AM
Re: Error while deleting subdirectories & files.
the problem is that your find has found a directory which qualifies for removal.
However the command for removing a directory is rmdir dirname
A rm -R will remove ALL files within that directory and the directory. Not what I think you want.
Generaly is best to test these commands out very thoroughly before using them to remove live files!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2006 01:06 AM
02-17-2006 01:06 AM
Re: Error while deleting subdirectories & files.
Well, rm does not work on directories. rmdir does.
You may want to test for directory files.
-type c "True if the type of the file is c, where c is:
f regular file
d directory"....
Also, check out -depth :
" A position-independent term which causes descent of the directory hierarchy to be done so that all entries in a directory are acted on before the directory itself.
man find for details...
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2006 01:07 AM
02-17-2006 01:07 AM
Re: Error while deleting subdirectories & files.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2006 08:19 PM
02-19-2006 08:19 PM
Re: Error while deleting subdirectories & files.
to remove directory use option R.
From man rm:
...
-R For each argument that is a directory, this option causes rm
to recursively delete the entire contents of that directory
before removing the directory itself. When used in
conjunction with the -i option, rm asks whether to examine
each directory before interactively removing files in that
directory and again afterward to confirm removing the
directory itself.
....
HTH,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2006 08:54 PM
02-19-2006 08:54 PM
Re: Error while deleting subdirectories & files.
The messages are related with diagnostic messages on regarding nonexistant operands.
Use -f with rm to delete files. Use -rf for directory deletion.
Use as,
find . -type f -mtime +90 -exec rm -f {} \;
find . -type f -mtime +90 | xargs rm -f
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2006 08:58 PM
02-19-2006 08:58 PM
Re: Error while deleting subdirectories & files.
In order to delete files, you can use -f option with "rm". Man page says,
-f Force each file or directory to be removed without prompting
for confirmation, regardless of the permissions of the
entry. This option also suppresses diagnostic messages
regarding nonexistent operands.
This option does not suppress any diagnostic messages other
than those regarding nonexistent operands. To suppress all
error message and interactive prompts, the -f option should
be used while redirecting standard error output to
/dev/null.
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2006 03:51 AM
02-20-2006 03:51 AM
Re: Error while deleting subdirectories & files.
Many have said to use -rf after rm, like :
find . -type f -mtime +90 -exec rm -rf {} \;
This is very strong. It'd be good to do this:
cd /mmm/nnnn && find . â mtime 35 â exec rm -rf {} \;
add your cd command to current directory in front of "find and delett".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2006 03:52 AM
02-20-2006 03:52 AM
Re: Error while deleting subdirectories & files.
Many have said to use -rf after rm, like :
find . -type f -mtime +90 -exec rm -rf {} \;
This is very strong. It'd be good to do this:
cd /mmm/nnnn && find . â mtime +90 â exec rm -rf {} \;
add your cd command to current directory in front of "find and delett".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2006 03:55 AM
02-20-2006 03:55 AM
Re: Error while deleting subdirectories & files.
should be:
cd /mmm/nnnn && find . -type f -mtime +90 -exec rm -rf {} \;
Chushia