Skip to main content

Script for File copy Older than X Days | ROBOCOPY Batch file

Hey All,

Issue :

One more challenge I faced yesterday.
Robocopy batch files which I scheduled were getting failed with error code 0x1

Observation : All robocopy schedules were getting failed with error code 0x1
One more thing I noticed is that the Task manager was showing multiple instances of Robocopy exe.

Task manager gave way to the solution

Solution :

After googling number of forums, I found switch to exit the Robocopy at the end. I added it at the end of command, but it did not work.

It gave error 0x80 :  Quitting : /QUIT Specified on Command Line.

After that I tried one more option. Defining one more line of code and specifying the /QUIT option there.

e.g.
*****************************************************************
@echo off
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b)
robocopy "\\share\source" "D:\Destination" *.xml /MAXAGE:3 /LOG+:"D:\Logs\%mydate%.log" /NP
 

robocopy /QUIT
*****************************************************************
 What does above script does :
  • Copies files which are not older than 3 Days from source to destination
  • Stores the logs Datewise (You can add %mytime% if you want time also)
  • Copies only XML extension (You can specify *.* if you want to copy all files)
Its working fine now.

Hope this helps to you as well.

Comments

Popular posts from this blog

Solved | SendGrid SSL CERTIFICATE_VERIFY_FAILED certificate verify failed | self signed certificate in certificate chain

Error :   PS C:\Ashish> & "C:/Program Files/Python39/python.exe" c:/Folder/SendEmail.py Traceback (most recent call last):   File "C:\Program Files\Python39\lib\urllib\request.py", line 1346, in do_open     h.request(req.get_method(), req.selector, req.data, headers,   File "C:\Program Files\Python39\lib\http\client.py", line 1279, in request     self._send_request(method, url, body, headers, encode_chunked)   File "C:\Program Files\Python39\lib\http\client.py", line 1325, in _send_request     self.endheaders(body, encode_chunked=encode_chunked)   File "C:\Program Files\Python39\lib\http\client.py", line 1274, in endheaders     self._send_output(message_body, encode_chunked=encode_chunked)   File "C:\Program Files\Python39\lib\http\client.py", line 1034, in _send_output     self.send(msg)   File "C:\Program Files\Python39\lib\http\client.py", line 974, in send     self.connect()   File "C:\Program Files\P

Change EMC Storage Management IP Address without Storage Reboot

Issue :  - How to Change EMC Storage Management IP Address without Reboot - Customer needs to change the IP address, subnet mask , default gateway of a CLARiiON or VNX for Block storage processor (SP)without rebooting the Storage Processors (SP) Scenario : EMC CLARiiON or VNX BLOCK Storage System Solution : 1) Download and Install Naviseccli utility  2)Run following command Add Security Parameters For SPA naviseccli -User admin -Password password -Address 172.XX.XX.XX -Scope 0 -AddUserSecurity For SPB naviseccli -User admin -Password password -Address 172.XX.XX.XX -Scope 0 -AddUserSecurity Get the info about existing SPs For SPA naviseccli -h 172.XX.XX.XX networkadmin -get For SPB naviseccli -h 172.XX.XX.XX networkadmin -get Change the IP Address For SPA naviseccli -h 172.XX.XX.XX networkadmin -set -address 172.XX.XX.XX -subnetmask 255.255.255.0 -gateway 172.XX.XX.XX naviseccli -h 172.XX.XX.XX networkadmin -set -address 172.XX.XX.XX -subnetmask 255.255.255

Fixed | WSUS 2016 | Error Code 0x8024401c | Windows 10 | Windows Server 2016

Scenario : Server : Windows WSUS Server 2016 Client : Windows 10, Windows Server 2016 Error Code :  0x8024401c on Windows 10 or Windows Server 2016 Solution : 1) Go to IIS Manager on WSUS Server 2) Goto Advance Settings of  WsusPool. 3) Make sure following settings are present/configured on the Pool, if not change it to below: Queue Length: 25000 Limit Interval (minutes): 15 "Service Unavailable" Response: TcpLevel Private Memory Limit (KB): 0 4) Make sure, the WSUS Entry in the Registry is having fully qualified domain name of WSUS Server. 5) Stop the IIS 6) Edit the web.config located at following location on WSUS Server : C:\Program Files\Update Services\WebServices\ClientWebService\web.config Replace <httpRuntime maxRequestLength="4096" /> with <httpRuntime maxRequestLength="204800" executionTimeout="7200"/> 7) Start the IIS 8) Retry updating clients. Done! Let me know if it has helped to y