Automatically Moving Plots in Ubuntu

For Powershell in Windows I’ve been using:

@echo off
set source=[source drive]
set destination=[destination drive]
robocopy %source% %destination% /mov *.plot /xx
timeout /t 60
goto loop

How can one duplicate this using a Bash script in Ubuntu?

So far I have:

for (( ; ; ))
mv mnt/Temp1/*.PLOT [destination directory]
sleep 60

Is there a better way to script this? Not concerned about duplicating the set command from PS, but wondering if the “for” loop is best and whether “sleep 60” will work as intended (check and move every minute).

Would also be nice if a new terminal session pops open when executing the script.

Much thanks!

Don’t need that many words. For me this works wonderfully on all my plotters. (Change drive letters to yours’.)

@echo off
move “E:*.plot*” H:
timeout /t 200

1 Like

Would this be for Powershell? Would this work as a bash script in Ubuntu?

sleep 60 will sleep for 60 seconds after the mv has finished. So each time this script loops, mv will start at least 60 seconds after the previous one started and almost exactly 60 seconds after the previous one ended.

The rest of the script looks ok. Here are a couple opinionated advice (how I would write it):

  • replace the for loop with a while true, or even better with a “while this file exists” so you can safely stop the loop by deleting a file.
  • use absolute paths instead of relative ones for mv, eg /mnt/Temp… instead of mnt/Temp…. This way you can initiate the script from wherever with no worries.

Depending on the terminal you’re using, there should be a way to do this. What are you trying to achieve with the terminal popping up?