Solved

Need a batch file quikly please

Posted on 2006-11-06
6
326 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

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,…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

729 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