LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-22-2014, 07:35 AM   #1
apss_evaluator
Member
 
Registered: Mar 2012
Posts: 115

Rep: Reputation: Disabled
bash command to move files


Hi Guru's

I'm still no good on linux, please bear with me.

I have two directories one is named as bkup and other is exec

bkup folder has 200 log files that needs to be moved to exec folder. We need 5 logs per batch every 2 minutes and the 5 logs that needs to be moved consists of the 1st five with the oldest time stamps.

I am doing the moving of logs manually, is there a shortcut mode to do this?, I mean in automated mode.
 
Old 12-22-2014, 08:42 AM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 7,225

Rep: Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350
You would need to write a script to perform the actions you want on whichever files and then use cron to do it on the schedule you want. There are numerous tutorials available on using cron.
 
Old 12-22-2014, 02:32 PM   #3
Miati
Member
 
Registered: Dec 2014
Distribution: Linux Mint 17.*
Posts: 326

Rep: Reputation: 106Reputation: 106
This question is difficult to understand... but as for running something every 2 or 5 minutes, place these in your crontab file using crontab -e

every 2 minutes:
Code:
*/2 * * * * commandorscript
every 5 minutes:
Code:
*/5 * * * * commandorscript
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[bash] Copy files, move files but not added ones errgrdgds Programming 4 05-24-2013 06:46 AM
[SOLVED] Bash script to move files from date cbing Programming 9 04-20-2012 05:45 AM
bash script to move files except the last 5 dappa Linux - Newbie 4 08-26-2011 02:01 PM
how to tell bash to move files to another folder? hq4ever Linux - Newbie 10 12-30-2010 03:15 AM
cannot using FTP move command to move files adrianmak Linux - Networking 4 04-21-2009 12:01 PM


All times are GMT -5. The time now is 12:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration