- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- 'ls' command to show the full path name
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
тАО06-11-2002 06:09 PM
тАО06-11-2002 06:09 PM
'ls' command to show the full path name
I am writing a find script to remove the ".log" files found on the system. However, I have difficulties on getting the full path name of the files before piping to "rm" command. Any idea?
Many thanks,
Chris,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2002 06:22 PM
тАО06-11-2002 06:22 PM
Re: 'ls' command to show the full path name
# cd /var/tmp
# find . -type f -name "*.log" -exec ll {} \;
It'll list any files with .log extension in /var/tmp in its relative path. So to remove them do ..
# find . -type f -name "*.log" -exec rm {} \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2002 06:31 PM
тАО06-11-2002 06:31 PM
Re: 'ls' command to show the full path name
You don't need to worry about the long name of the files, the find command takes care of that for you.
# find /myfilesystem -type f -name "*.log" -print -exec rm {} \;
You could also put this into cron to do it automatically should you wish. The example I've shown here is to run the command at 5AM every Sunday. Have a look at the man page on 'cron' for further info.
0 5 * * 0 find /myfilesystem -type f -name "*.log" -print -exec rm {} \;
Cheers
~Michael~
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2002 07:50 PM
тАО06-11-2002 07:50 PM
Re: 'ls' command to show the full path name
As our Pharoahs mentioned it is really good to see the list of files.
For example all my oracle redologfiles have a ".log" extension.
I am to remove without knowing is going to be hard.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2002 07:55 PM
тАО06-11-2002 07:55 PM
Re: 'ls' command to show the full path name
Of course we restrict the search and subsequent removal of files to only filesystems that we wish to actually remove the files from. From my example it doesn't choose '/' but a filesystem name of your choice.
Cheers
Michael