LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   bash command to move files (https://www.linuxquestions.org/questions/linux-newbie-8/bash-command-to-move-files-4175528995/)

apss_evaluator 12-22-2014 07:35 AM

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.

yancek 12-22-2014 08:42 AM

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.

Miati 12-22-2014 02:32 PM

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


All times are GMT -5. The time now is 05:34 AM.