Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Need a batch file quikly please

Posted on 2006-11-06
6
Medium Priority
?
338 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:Seelan Naidoo
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 2000 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Many of us need to configure DHCP server(s) in their environment. We can do that simply via DHCP console on server or using MMC snap-in on each computer with Administrative Tools installed in a network. But what if we have to configure many DHCP ser…
I've always wanted to allow a user to have a printer no matter where they login. The steps below will show you how to achieve just that. In this Article I'll show how to deploy printers automatically with group policy and then using security fil…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

916 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