Solved

Need a batch file quikly please

Posted on 2006-11-06
6
277 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:Nick Sui
  • 2
6 Comments
 
LVL 10

Expert Comment

by:SeanUK777
Comment Utility
0
 
LVL 38

Expert Comment

by:Shift-3
Comment Utility
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:Nick Sui
Comment Utility
Shift-3,

yes please.
0
 
LVL 38

Accepted Solution

by:
Shift-3 earned 500 total points
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I have never ceased to be amazed how many problems you can encounter on a fresh install of a Windows operating system.  This is certainly case in point& Unable to complete ANY MSI installation.  This means Windows Updates are failing and I can't …
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now