- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: move log files in linux
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-18-2005 05:10 PM
12-18-2005 05:10 PM
move log files in linux
I am actually trying to move/copy all of the files with extension as '.log' to a different directory.
Itried using the command "find -name '*.log' -print -exec cp {} \;" But every time i try to run it i get the exception missing destination file.
can any one of you please help me out I am in immediate need of it Please Please please...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2005 06:08 PM
12-18-2005 06:08 PM
Re: move log files in linux
find /var -type f -name "*.log" -exec cp {} /tmp/log \;
where /var is the directory to look in and the destination directory is /tmp/log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2005 08:14 PM
12-18-2005 08:14 PM
Re: move log files in linux
find -name '*.log' -print -exec cp {} \;
Use as,
find
# find /var -name '*.log' -type f -exec cp {} /tmp/ \;
# find /var -name '*.log' -type f -exec > {} \;
First will do copy to /tmp directory. Second will remove (>) all contents in that file.
-Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2005 10:10 PM
12-18-2005 10:10 PM
Re: move log files in linux
find
If you want to find any logfile entire your linux you have to use the following command:
find / -name '*.log' -print -exec cp {} \;
Also most of the log files located in /var, you can use "/var" instead of "/", but if you have non-standard log files, "/" is a better choise.
Alireza
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2005 10:38 PM
12-18-2005 10:38 PM
Re: move log files in linux
You have not specified the path to the find command.
You have not specified the destination path to the cp command.
Change to something like this:
find /where/to/start/the/search -name "*.log" -exec cp {} /destination/to/copy/files \;
For example:
find /var/log -name "*.log" -exec cp {} /usr/oldlogs \;