Robocopy (send plots automaticly) help

hello guys,
its me again and need help again! :slight_smile:
With the developing technology, plot production times have really decreased. this led to the need to update existing scripts (at least for me)
i am using this script for copy plot files but problem is hard drive going to full. so i need a loop example;
send 70 plot files to a drive from the source , after that stop all and start copy 70 plot files to b drive. from the source.

@echo off
:RESTART
TITLE Transfer Plots from temporary to final location
echo.
robocopy E:\gidenler G:\ “plot*.plot” /MOV /MT:32
echo.
timeout 10 /nobreak
GOTO RESTART

pause

thank you.

Just make a python script with a while loop and a time.sleep(60)

you might want to consider copying to two drives in parallel (im guessing you are copying from an nmve to hdd):
Its just written down, i didnt test both versions you might encounter an issue which you have to correct.

copy_plots.ps1:

$src = "E:\gidenler"
$destA = "A:\"
$destB = "B:\"
$filePattern = "plot*.plot"
$fileLimit = 70

while ($true) {
    # Start a new job to copy files to drive A
    Start-Job -ScriptBlock {
        robocopy $using:src $using:destA $using:filePattern /MOV /MT:32 /LIMIT:$using:fileLimit
    }

    # Start a new job to copy files to drive B
    Start-Job -ScriptBlock {
        robocopy $using:src $using:destB $using:filePattern /MOV /MT:32 /LIMIT:$using:fileLimit
    }

    # Wait for both jobs to complete
    Wait-Job -Any

    # Wait for 10 seconds before repeating the loop
    Start-Sleep -Seconds 10

    # Prompt user to press Enter to continue
    Write-Host "Press 'Enter' to repeat or 'q' to exit"
    $key = [Console]::ReadKey()
    if ($key.Key -eq "q") {
        break
    }
}

My best guess is that you want to change the harddrives after the 70 plots.
The script pauses after copying to both drives. pressing enter will start the next loop and copy 70 files to both drives again.

If you want to loop indefinitely without pause, remove the last part.

1 Like

thank you for helping me.
i generate bat file but when i double click on it, its closed itself really fastly. i cant see anything and not move anything :frowning:

  1. save as copy_plots.ps1

  2. start powershell

  3. navegate to the script location with cd {path to copy_plots.ps1}

  4. type copy_plots.ps1 and press enter.
    The blue powershell window should now persist and show you what the error is.

2 Likes

Here is another sample that I use.

Copy this into a file called move_plot1.cmd

:RESTART
TITLE Move Plots from Drive1 to Drive2
echo.
ROBOCOPY “E:\plots” “P:\k32” “plot*.plot” /MOV /Z /R:999 /W:5
echo.
timeout 10 /nobreak
GOTO RESTART

pause

This script came from someone in this forum.

1 Like

my question is a bit diffrent but thank you for help :slight_smile: