Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 12-22-2014, 08:35 AM   #1
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, 09:42 AM   #2
LQ Guru
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 7,330

Rep: Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404Reputation: 1404
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, 03:32 PM   #3
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:
*/2 * * * * commandorscript
every 5 minutes:
*/5 * * * * commandorscript


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 07:46 AM
[SOLVED] Bash script to move files from date cbing Programming 9 04-20-2012 06:45 AM
bash script to move files except the last 5 dappa Linux - Newbie 4 08-26-2011 03:01 PM
how to tell bash to move files to another folder? hq4ever Linux - Newbie 10 12-30-2010 04:15 AM
cannot using FTP move command to move files adrianmak Linux - Networking 4 04-21-2009 01:01 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:48 PM.

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