-   Programming (
-   -   Simple Bash Script Help (

njdownes 03-05-2005 07:09 AM

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.

ilikejam 03-05-2005 07:20 AM


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


cd /test
while true
  mv *.dat /test2
  sleep 2


njdownes 03-05-2005 07:35 AM


All times are GMT -5. The time now is 11:34 PM.