[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

copy out files created / modified since date using xcopy  / robocopy

Posted on 2011-10-26
11
Medium Priority
?
806 Views
Last Modified: 2012-05-12

I've just got a new laptop & restored using Ghost image that's taken about 1 month
ago.

If I want to copy out only files that have been created / modified since say 5 Sep 2011,
what's the exact syntax :

xcopy ...  /D:m-d-y     Copies files changed on or after the specified date.

or robocopy ??
0
Comment
Question by:sunhux
  • 4
  • 3
  • 3
  • +1
11 Comments
 

Author Comment

by:sunhux
ID: 37031501

If possible, I would like it such that xcopy (preferred over robocopy as I haven't got
a copy of robocopy) or  robocopy copies the directory structure/path out as well of
those files as I'm using an external USB HDD to transfer :

so wud just want to be able to seamlessly copy over to the new laptop to update
the files to the latest.
0
 

Author Comment

by:sunhux
ID: 37031527
In the 2nd post, let me give an example:

suppose on the old laptop, I have  d:\dir1\dir12\aaa.txt
which I wanted to copy out to the external USB HDD  (which
will be shown as I: drive when connected to the old laptop),
I would like to be able to copy aaa.txt out to I:\dir1\dir12\aaa.txt

If you're suggesting to use LAN to transfer, pls provide the detailed steps as well.
0
 
LVL 43

Accepted Solution

by:
Steve Knight earned 1000 total points
ID: 37031589
If you can access the old and new data over the LAN the easy way would be to use xcopy /d to copy any changed date, e.g. run this from cmd.exe prompt on NEW pc:

net use x: \\oldpc\c$
(You may have to enter user/password if different on old PC)

xcopy /e /l /d "x:\dir1\*.*" "c:\dir1"

That will show you the files it would copy ... remove the /l and it will do it.

If the list is too long, or so you have list to check through easier:

xcopy /e /l /d "x:\dir1\*.*" "c:\dir1" > log.txt
notepad log.txt

Then for real:


xcopy /e /d "x:\dir1\*.*" "c:\dir1" > log.txt 2> errors.txt
start log.txt
start errors.txt

If you have any hidden or system files you want to copy then you may need extra switches on xcopy.

Otherwise you can use /D with date parameter but above would copy anything that is newer regardless of date.

If in doubt try on a copy of your data of course - e.g. you could copy all your old PC data onto a USB hard drive and then on the new PC do the xcopy from there.

Steve
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 26

Assisted Solution

by:pony10us
pony10us earned 500 total points
ID: 37031628
Let me ask a couple of questions.

1. Does the folder structure already exist on the external HDD or do you need to create it "on the fly"?
2. Is there a possiblity of the following:
        d:\dir1\dir12\aaa.txt    created   10/1/2011  (meets date requirement)
        d:\dir1\dir12\bbb.txt    created   8/1/2011    (does not meet date requirement)

If the external HDD is an empty disk then you should be able to use xcopy with the date parameters as you show in the initial post without much issue.

To perform the copy from i:\

xcopy c:\ /s /e /d:9/5/2011

0
 
LVL 26

Expert Comment

by:pony10us
ID: 37031788
Steve,

I like your solution as usual.  However I have a question (again as usual :) )

Shouldn't the start commands in the "for real" section read:

start notepad log.txt
start notepad errors.txt

or am I missing something?

0
 
LVL 59

Assisted Solution

by:Bill Prew
Bill Prew earned 500 total points
ID: 37031816
@pony10us

start log.txt will work, it will just use whatever default program is associated with the TXT file extension to open the file.  Typically this is notepad by default, but in the case that someone changed this to say use Notepad++, then this approach will open with whatever the assigned application is.

~bp
0
 
LVL 26

Expert Comment

by:pony10us
ID: 37031876
Thanks Bill,  I thought that might be the case but wanted to verify. I guess that would be good if someone prefers a different default reader.
0
 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 1000 total points
ID: 37031982
thanks Bill, yes that was what i was getting at ... Of course it is then complicated by needing to do start "" "file  with space.txt" if there is a space in the path but ok in this case the simple way and using start means both log windows can open up too.

Steve
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 37049109
@sunhux --> Any luck with this, do you need any more help on it?

Steve
0
 

Author Closing Comment

by:sunhux
ID: 37055268
excellent
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 37055346
No problem, glad it helped.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

A brief introduction to what I consider to be the best editor for PowerShell.
In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Screencast - Getting to Know the Pipeline

867 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