Solved

Need a batch file quikly please

Posted on 2006-11-06
6
292 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

This may not be a text book method to resolve VSS backup issues but it seemed to have worked on few of the Windows 2003 servers we had issues while performing a Volume Shadow Copy backup. If you have issues while performing a shadow copy backup usin…
Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 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

22 Experts available now in Live!

Get 1:1 Help Now