- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- move file script
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
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
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
тАО09-10-2009 06:52 AM
тАО09-10-2009 06:52 AM
I am trying to move a file on many servers. I am going to use a find command to find the file under /home and if it is found then move it to /var.
Like find / -name abc.txt and if abc.txt is found then move it to /var.
Can someone tell me how I can do this using a simple script.
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2009 06:55 AM
тАО09-10-2009 06:55 AM
Re: move file script
---
find / -name abc.txt -exec mv {} /var \;
---
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2009 07:01 AM
тАО09-10-2009 07:01 AM
Re: move file script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2009 07:05 AM
тАО09-10-2009 07:05 AM
Solution> How about using the find command only to look at a specific location like just /tmp.
Of course, in fact you can look at multiple locations all at once:
# find /tmp /home -xdev -type f -name "*.log"
It is generally a good idea to add the '-xdev' argument to prevent crossing mountpoints. This can be especially important when visiting the '/' directory.
The '-type f' argument means confine results only to files; not directories, for instance.
The double quotes around the '-name' argument prevent the shell from expanding the filename. This lets the expression be passed along to 'find'.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2009 07:19 AM
тАО09-10-2009 07:19 AM
Re: move file script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2009 07:48 AM
тАО09-10-2009 07:48 AM
Re: move file script
I see that you are new to this Forum. Welcome!
That said, please read the link below about points. Points are not only a way of saying "thanks!" but bread-crumbs for future trollers to find the tastiest (most applicable) solution:
http://forums.itrc.hp.com/service/forums/helptips.do?#28
...JRF...