- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- find and -exec
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-20-2009 12:50 PM
02-20-2009 12:50 PM
find and -exec
I'd like to do something like this:
find /su01 -name webutil.plx -exec rm {} \;
but before the erase i'd like to copy the file with the extension .20090220 to have by example the file webutil.plx.20090220.
(Note. copy before because I want a new inode)
How to do this small affair ?
bests Regards
Den
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2009 02:01 PM
02-20-2009 02:01 PM
Re: find and -exec
> inode)
Why? "mv" makes more sense to me than a
copy-and-delete scheme.
If you really want to do two things, you can
use more than one "-exec" clause in one
"find" command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2009 07:52 AM
02-21-2009 07:52 AM
Re: find and -exec
You can also invoke a script to do what you want. You may want your script to be able to handle multiple files by using a for or while loop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2009 08:46 AM
02-23-2009 08:46 AM
Re: find and -exec
* backing up all webutil.plx in a tar and removing them
$tar cvf plx.tar $(find ./ -name webutil.plx) && find ./ -name webutil.plx -ok rm {} \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2009 08:46 AM
02-23-2009 08:46 AM
Re: find and -exec
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2009 10:35 AM
02-23-2009 10:35 AM
Re: find and -exec
find /su01 -name webutil.plx |xargs rename .plx .20090220
To rename and create a new plx file.
cd /su01
ls *.plx | awk -F"." '{print $1}' | while read file; do mv ${file}.plx ${file}.02232009; touch ${file}.plx; ls -il; done
ls -i should show a different inode.