Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

using xcopy command

Posted on 2011-04-26
15
Medium Priority
?
434 Views
Last Modified: 2012-05-11
Hello, i am trying to compile a 'XCOPY' script which automatically copies 'modified' files to an alternative location.
I have used this but this copies all the files + folders
To copy a folder including all subfolders.
XCOPY C:\docs\* Y:\ /s /i

hope you can assist.
0
Comment
Question by:Mandev23
  • 6
  • 3
  • 3
  • +2
15 Comments
 
LVL 3

Accepted Solution

by:
kraiven earned 750 total points
ID: 35465634
I think you just need to add the /D switch.
/D:mm-dd-yyyy copies files changed on or after mm-dd-yyyy
/D alone only copies files with a newer date. So:

XCOPY C:\docs\* Y:\ /s /i /D

Open in new window


Should do the trick
0
 

Author Comment

by:Mandev23
ID: 35465674
kraiven
strange thing, cant seem to run the script. attached is what i get.  am i doing something wrong?
i have the xopy application file sitting in the C: drive
error.JPG
0
 
LVL 3

Expert Comment

by:kraiven
ID: 35465706
Hmm! That's interesting - I've just tried it out and it works perfectly for me. It look s like the system is complaining about the wrong version of MS-DOS. what version do you have?
0
Who's Defending Your Organization from Threats?

Protecting against advanced threats requires an IT dream team – a well-oiled machine of people and solutions working together to defend your organization. Download our resource kit today to learn more about the tools you need to build you IT Dream Team!

 

Author Comment

by:Mandev23
ID: 35465779
i am using DOS version 5.1.2600
where can i find a compatible xcopy ?
0
 
LVL 52

Expert Comment

by:Jackie Man
ID: 35465791
The xcopy command has been discussed in depth in the question below.

http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/Q_20814544.html

It seems that the xcopy command will not work exactly for what you want in command prompt of xp and you need a ms dos boot disk to boot up the system in order to make it work.
0
 
LVL 3

Expert Comment

by:kraiven
ID: 35465813
Oh! I'm using a DOS shell from Windows XP. Ver: Microsoft Windows XP [Version 5.1.2600]????
0
 
LVL 17

Assisted Solution

by:Sikhumbuzo Ntsada
Sikhumbuzo Ntsada earned 750 total points
ID: 35465864
This should do the trick:

Example 1
xcopy "c:\program Files\Ericsson" "scan_server1\I$\Print_Server" /S /E /C /Y /K /D /Z

In the following example you first have to map the drive:

Example 2
xcopy "c:\program Files\Ericsson" "i:\sau_oas\Ericsson" /S /E /C /Y /K /D /Z
0
 

Author Comment

by:Mandev23
ID: 35466058
thanks both.
i have taken the code snipets you both having given... and found this
if i rename an existing file, xcopy copies the file to the target directory as a 'new' file, which is not right. should it not copy the renamed file and over-write it in the target directory ?
0
 
LVL 17

Expert Comment

by:Sikhumbuzo Ntsada
ID: 35466094
If you re-named the file, then it's a new file and will be treated like that, if what you want is a script that looks at a file and copy the one with changes on it, then try vb scripts.
0
 
LVL 39

Expert Comment

by:BillDL
ID: 35474231
Mandev

The word "forkert" is Danish and Norwegian (possibly also other German-derived Baltic and Scandinavian languages) meaning "Wrong" and "Improper" respectively.  It doesn't seem to be a Dutch word, although possibly could have been used in Flemish and passed on to languages like Afrikaans.

I see you are in the UK.  Are you using a Danish or Norwegian version of Windows XP?

Just out of curiosity, and not related to your question, does B.S.A.P. mean anything to you?
0
 
LVL 39

Expert Comment

by:BillDL
ID: 35474365
I just noticed something.  You said:
"Am I doing something wrong? I have the xopy application file sitting in the C: drive".

By default in Windows XP XCOPY.EXE should be here:

C:\WINDOWS\system32\xcopy.exe

Check to see if it exists there and Right-Click on it > Properties.  The version should be (for a Windows XP SP3 system):
5.1.2600.5512 (xpsp.080413-2111)

If that file is OK, then I suggest you rename the xcopy.exe in the root of your C:\ Drive to something like "renamed_xcopy.exe".

If, after a couple of seconds, C:\xcopy.exe is replaced there, then it will have been replaced there from the "C:\Windows\System32\dllcache" folder because there is something screwy with where Windows originally installed the program file on your computer.

Let us know what happens.
0
 

Author Comment

by:Mandev23
ID: 35511148
all,
xcopy is working on some scripts.
However i cannot seem to copy this 'Outlook' folder to Y:\New Folder ??

xcopy "C:\Documents and Settings\mdass\Local Settings\Application Data\Microsoft\Outlook\" "Y:\New Folder" /S /E /C /Y /K /D /Z

nothing happens when i run the script....
0
 
LVL 17

Expert Comment

by:Sikhumbuzo Ntsada
ID: 35511215
you might have problems if the application is open.
0
 

Author Comment

by:Mandev23
ID: 35511304
santasi24
No still does not work... all i'm trying to do is copy a folder with files to a network drive
?
0
 

Author Closing Comment

by:Mandev23
ID: 35688434
slow response from experts, replies not accurate enough with little reasoning / grasp of the problem
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

A walk-through example of how to obtain and apply new DID phone numbers to your cloud PBX enabled users that are configured in Office 365. Whether you have 1, 10 or 100+ users in your tenant, it's quite easy to get them phone-enabled and making/rece…
Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

577 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