[HowTo] get notified when a copy job is done

Discuss new features and functions
Posts: 7
Joined: 1 Oct 2022

RamSa

Hi all,

on my system copy jobs take ages (a FDE-ed SDXC features ~5MB/s write speed) so I wrote a script that notifies me when the job is actually finished (writing to disk is finished)*, maybe it is of help to anyone else.

Requirements: grep and gawk from CygWin in the path (don't forget the necessary DLLs, but Win will tell you)

HowTo: Press F8 to go to config, lowest entry "run a command" you run
start /MIN [path]\myCoolDiskWatcher.bat
To list your disks you can run
typeperf "\PhysicalDisk(*)\% Disk Time"
, 1st line of output lists your disks. Adapt script (just the number in "PhysicalDisk(2*)") in to reflect your config.


HTH!

* Veracrypt (my FDE tool) unfortunately uses kinda cache, so FFS is finished tens of minutes before the cache is written down)


the batch file:
@echo off
REM quit if disk unavailable
typeperf "\PhysicalDisk(2*)\%% Disk Time" -sc 1  && goto START
msg /TIME:0 * phys. disk 2 not found
goto END

:START
sleep 15
echo %%TIME%%    -    | tr -d "\r\n" && typeperf "\PhysicalDisk(2*)\%% Disk Time" -sc 1 | grep / | gawk -F """" '{ print $4 }'
REM check activity percentage
typeperf "\PhysicalDisk(2*)\%% Disk Time" -sc 1 | grep / | gawk -F """" '{ print $4 }' | grep 0\. || goto START

REM re-check twice after 10s each to make sure the job is finished
sleep 10
typeperf "\PhysicalDisk(2*)\%% Disk Time" -sc 1 | grep / | gawk -F """" '{ print $4 }' | grep 0\. || goto START
sleep 10
typeperf "\PhysicalDisk(2*)\%% Disk Time" -sc 1 | grep / | gawk -F """" '{ print $4 }' | grep 0\. || goto START

msg /TIME:0 * copy to V:\ copy finished, start next job

:END
exit
User avatar
Posts: 4056
Joined: 11 Jun 2019

xCSxXenon

FFS also has a feature to run a command after finishing. This may not be what you want, since you stated there is some time before the VareCrypt cache is dealt with
Posts: 7
Joined: 1 Oct 2022

RamSa

FFS also has a feature to run a command after finishing. This may not be what you want, since you stated there is some time before the VareCrypt cache is dealt with xCSxXenon, 19 May 2024, 14:19
Yeah, how do you think I do start the batch?
HowTo: Press F8 to go to config, lowest entry "run a command" you run
start /MIN [path]\myCoolDiskWatcher.bat
RamSa, 19 May 2024, 07:03