Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-05-2005, 08:09 AM   #1
LQ Newbie
Registered: Feb 2005
Posts: 10

Rep: Reputation: 0
Simple Bash Script Help

Hi there.

I'm new to bash scripting and basically, I want to do the following and was wondering if someone could give me some pointers and show me the best way of doing it.

Basically, I want to poll a directory, let's call it /test and see if there are any files with the extension .dat, if there are any then I want them moved to another directory (/test2).
I want the script to loop until it finds these files, then move them and then once finished moving them, just carry on polling /test.

Any help with this would be greatly appreciated.

Thanks in advance.
Old 03-05-2005, 08:20 AM   #2
Senior Member
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 96

It would take longer to explain than it would to just write the script:

cd /test
while true
  mv *.dat /test2
  sleep 2
Old 03-05-2005, 08:35 AM   #3
LQ Newbie
Registered: Feb 2005
Posts: 10

Original Poster
Rep: Reputation: 0


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
Simple bash script lp449 Linux - Networking 3 08-02-2005 05:25 PM
Simple bash script Soulful93 Programming 1 06-04-2005 08:26 PM
Simple Bash Script dmedici Programming 9 12-31-2004 04:48 AM
Help with simple bash script - please tw001_tw Linux - Software 5 12-19-2004 10:02 PM
Simple BASH script fio Linux - General 5 01-18-2003 04:26 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:53 AM.

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