Solved

Need a batch file quikly please

Posted on 2006-11-06
6
301 Views
Last Modified: 2010-04-18
From Source to destination:

Source : L: Drive
Destination K: Drive

Logic:

1. Create a new directory on destination drive (K:)

2. Write files from L: to K: Drive

3. If file does not exist on K Drive copy it.

4. If file exists on K: Drive only copy file if Date is < than 18 Oct

5. If file exists on K: Drive do no write if Date = 18 Oct

6. If the date of file on K: Drive is the same Do not copy the file.

Thanks!
0
Comment
Question by:Nirmal Sharma
  • 2
6 Comments
 
LVL 10

Expert Comment

by:SeanUK777
ID: 17881860
0
 
LVL 38

Expert Comment

by:Shift-3
ID: 17881936
Some clarification is needed.

Do you want to copy files from L:\ to K:\NewFolder based on which files already exist in K:\?
0
 
LVL 35

Author Comment

by:Nirmal Sharma
ID: 17882032
Shift-3,

yes please.
0
 
LVL 38

Accepted Solution

by:
Shift-3 earned 500 total points
ID: 17883100
This script should do what you're asking.  Copy everything below the line into a text file with a .cmd extension.  Either place it in the same directory as robocopy.exe or place robocopy somewhere in the path.

Please test this before using it in a production environment.

---------------
@echo off
setlocal

REM The directory to copy files from
set Source=L:\

REM The directory to check files against
Set CheckAgainst=K:\

REM The directory to copy files to
Set Destination=K:\NewFolder

REM Exclude all files modified on or after this date
Set CheckDate=20061018

REM The command to compare file ages
set CheckAge=robocopy "%source%" "%checkagainst%" /minage:%checkdate% /L /NS /NC /NJH /NJS

for /F "tokens=* skip=2" %%G in ('%CheckAge%') do robocopy "%source%" "%destination%" "%%G" >NUL

endlocal
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I guess it is not common knowledge to most Wintel engineers/administrators: If you have an SNMP-based monitoring system in your environment (and it's common to have SNMP or Syslog) it's reasonably easy to enable monitoring of the Windows Event logs,…
Numerous times I have been asked this questions that what is it that makes my machine log on so slow, there have been cases where computers took 23 minute exactly after taking password and getting to the desktop. Interesting thing was the fact th…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question