Robocopy Summary Times not correct - robocopy

I've set up a robocopy script and it functions correctly.
However, within the summary in the log file, the Total Times does not make sense to me as the job runs for about 109 minutes, but total returns 3:39:06?
Can someone explain why this looks wrong.
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : 03 April 2019 20:30:04
Source : G:\Backup\
Dest : \\newserver\Backup\
Files : refresh*
Options : /V /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /Z /PF /MT:1 /R:5 /W:5
------------------------------------------------------------------------------
New File 21.0 g G:\Backup\refresh.bak
Total Copied Skipped Mismatch FAILED Extras
Dirs : 1 1 0 0 0 0
Files : 1 1 0 0 0 0
Bytes : 21.019 g 21.019 g 0 0 0 0
Times : 3:39:06 0:54:46 0:00:00 0:54:46
Ended : 03 April 2019 22:19:37

Related

Robocopy behaves differently when running directly or from powershell script

I have a script that copies a file from a network location to a local folder using robocopy.
When I run following powershell 7 script from Visual Code, or execute the command directly in PS, only 1 file is copied as intended. If a run the script in powershell 4 files are copied. How can I copy the single file running from the script.
$dbname = "domoticz.db"
$sourcedir="\\ix2\PiBackup\domoticz\"
$targetdir="C:\tmp\DomoticzScripts\"
$dbfile = $targetdir + $dbname
robocopy $sourcedir $targetdir $db -njh
Output running it directly or VS Code debugger
New Dir 1 \\ix2\PiBackup\domoticz\
100% New File 8.9 m domoticz.db
------------------------------------------------------------------------------
Total Copied Skipped Mismatch FAILED Extras
Dirs : 1 1 0 0 0 0
Files : 1 1 0 0 0 0
Bytes : 8.96 m 8.96 m 0 0 0 0
Times : 0:00:00 0:00:00 0:00:00 0:00:00
Speed : 70709894 Bytes/sec.
Speed : 4046.052 MegaBytes/min.
Ended : zaterdag 30 mei 2020 11:45:40
Running it in a script
New Dir 4 \\ix2\PiBackup\domoticz\
100% New File 8.9 m domoticz.db
100% New File 32768 domoticz.db-shm
100% New File 0 domoticz.db-wal
100% New File 9.0 m domoticz_.db
------------------------------------------------------------------------------
Total Copied Skipped Mismatch FAILED Extras
Dirs : 1 1 0 0 0 0
Files : 4 4 0 0 0 0
Bytes : 18.05 m 18.05 m 0 0 0 0
Times : 0:00:00 0:00:00 0:00:00 0:00:00
Speed : 75125841 Bytes/sec.
Speed : 4298.735 MegaBytes/min.
Ended : zaterdag 30 mei 2020 11:47:06

Parsing Text String

I have created a running windows process list to a text file using the command:
tasklist > c:\mytasklist.txt. The result something like this:
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
System Idle Process 0 Services 0 24 K
System 4 Services 0 12.408 K
smss.exe 320 Services 0 1.236 K
csrss.exe 424 Services 0 4.720 K
wininit.exe 516 Services 0 4.684 K
csrss.exe 524 Console 1 7.888 K
winlogon.exe 572 Console 1 7.764 K
services.exe 620 Services 0 9.532 K
and so on...
My question:
How I parsing the line on the text file, so I get output like the following format using Lua script:
PID - Process Name - Memory Usage
And the output automatic sorted by the biggest memory usage
local tasklist = io.popen"tasklist /fo csv /nh"
local list = {}
for line in tasklist:lines() do
local exe, pid, mem = line:match'^"(.-)","(%d+)",.-"([^"]+)"$'
table.insert(list, {pid = tonumber(pid), exe = exe, mem = tonumber((mem:gsub("%D", "")))})
end
tasklist:close()
table.sort(list, function(a, b) return a.mem > b.mem end)
for j = 1, math.min(10, #list) do
print(list[j].pid, list[j].mem, list[j].exe)
end
Output:
1036 549416 svchost.exe
4972 439524 firefox.exe
6540 214476 plugin-container.exe
7144 169268 OUTLOOK.EXE
532 75320 svchost.exe
1948 71644 avp.exe
3752 62704 svchost.exe
5268 61100 explorer.exe
596 56732 csrss.exe
5048 50248 CcmExec.exe

Robocopy "invalid parameter" for file names beginning with "-" (minus sign)

I use robocopy to backup folders and individual files via a batch file. This works fine for all folders and nearly all files, but not for files where the name starts with a "-" (minus sign).
My OS: German Windows 7, 64 Bit. (I don't know if that matters.)
My test batch file does this:
SET fileName=-Test.rar
robocopy "folder 1" "folder 2" "%fileName%"
ECHO Errorlevel: %Errorlevel%
Where %fileName% is quoted because the file name may contain spaces as well.
The result is an ERROR : Invalid Parameter.
-------------------------------------------------------------------------------
ROBOCOPY :: Robustes Dateikopieren für Windows
-------------------------------------------------------------------------------
Gestartet: Wed Nov 21 15:42:47 2018
Quelle - E:\BackupThisFile\folder 1\
Ziel - E:\BackupThisFile\folder 2\
Dateien :
Optionen: /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
FEHLER: Ungültiger Parameter #3 : "-Test.rar"
[...]
Errorlevel: 16
Tested versions of "robocopy.exe":
XP010 (Windows XP?)
XP026 (Windows 2000?)
XP027 Win7 32 Bit
XP027 Win7 64 Bit
It always resulted in the same error message or only the equivalent error code 16.
Tested variation of the command:
Then i have tried different variations of the command. Only 1 change (additional quotes) looked remotely promising:
robocopy "folder 1" "folder 2" \""%fileName%""
But it didn't work either:
-------------------------------------------------------------------------------
ROBOCOPY :: Robustes Dateikopieren für Windows
-------------------------------------------------------------------------------
Gestartet: Wed Nov 21 15:43:00 2018
Quelle : E:\BackupThisFile\folder 1\
Ziel : E:\BackupThisFile\folder 2\
Dateien : "-Test.rar"
Optionen: /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
0 E:\BackupThisFile\folder 1\
------------------------------------------------------------------------------
Insgesamt KopiertÜbersprungenKeine Übereinstimmung FEHLER Extras
Verzeich.: 1 0 1 0 0 0
Dateien: 0 0 0 0 0 0
Bytes: 0 0 0 0 0 0
Zeiten: 0:00:00 0:00:00 0:00:00 0:00:00
Nothing was copied even though the file name parameter was kind of recognized.
I guess that the quotes in the value of the parameter are wrong as well.
Does anyone have an idea?

Listing the users who have actually submitted jobs in LSF

I am use the following command to list all users and there pending jobs in LSF:
busers -w all
Example output:
USER/GROUP JL/P MAX NJOBS PEND RUN SSUSP USUSP RSV MPEND
aaaaa - - 0 0 0 0 0 0 200
bbbbb - - 100 50 50 0 0 0 200
ccccc - - 1 0 1 0 0 0 200
I'm looking for a command that will only display the users whose NJOBS value is greater than 0, i.e. those who have actually submitted at least one job.
In the example, that would mean that only the lines for users 'bbbbb' and 'ccccc' should appear.
To check all users jobs the simpler method would be:
bjobs -u all
To check suspended ones just use:
bjobs -u all | grep SUSP

How can I add totals from a file in a dos batch

I want to add totals from lines in a text file.
My file.txt looks like this:
Totals: 7 passed, 0 failed, 0 skipped
Totals: 10 passed, 0 failed, 0 skipped
Totals: 6 passed, 0 failed, 0 skipped
Totals: 9 passed, 0 failed, 0 skipped
Totals: 4 passed, 0 failed, 1 skipped
Totals: 31 passed, 0 failed, 0 skipped
Totals: 10 passed, 0 failed, 0 skipped
Totals: 4 passed, 0 failed, 0 skipped
Totals: 8 passed, 0 failed, 0 skipped
So when I run sumtotals.bat file.txt then I want something like this:
Passed : XX
Failed : 0
Skipped: X
You can to this:
#echo off
set passed=0
set failed=0
set skipped=0
for /f "tokens=2,4,6 delims= " %%a in (%1) do call :add %%a %%b %%c
echo passed=%passed%
echo failed=%failed%
echo skipped=%skipped%
goto :eof
:add
REM echo %1 %2 %3
set /a passed=%passed%+%1
set /a failed=%failed%+%2
set /a skipped=%skipped%+%3
:eof
result:
C:\temp>sumtotals.bat file.txt
passed=89
failed=0
skipped=1