Copy files that were created yesterday to parent directory

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
steelrodman
Posts: 3
Joined: 31 Jan 2012 09:07

Copy files that were created yesterday to parent directory

#1 Post by steelrodman » 12 Sep 2012 02:41

Hi All,

I'm looking for a batch file that will copy .txt files to the parent directory one day after they are created.

For example:

1st Jan, 2012 -
hello.txt is created in C:\Parent\Subdir\

2nd Jan, 2012
Batch file is run, hello.txt is copied to C:\Parent\

3rd Jan, 2012
No more files have been created, Batch file is run and does nothing, because hello.txt was created 2 days ago, not 1.


Is this possible?

Thanks for reading

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Copy files that were created yesterday to parent directo

#2 Post by foxidrive » 12 Sep 2012 03:11

What is the granularity of the check? 22 hours old enough? 23?

What happens when it's 25 hours old, but the batch file wasn't run. It won't be copied.

parthe
Posts: 1
Joined: 04 Feb 2013 05:54

Re: Copy files that were created yesterday to parent directo

#3 Post by parthe » 04 Feb 2013 06:34

i am also searching for the answer....any luck??

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Copy files that were created yesterday to parent directo

#4 Post by foxidrive » 04 Feb 2013 07:54

This batch file is run once a day. Right?

And the hello.txt remains in the parent folder? That's easy.

Ocalabob
Posts: 79
Joined: 24 Dec 2010 12:16
Location: Micanopy Florida

Re: Copy files that were created yesterday to parent directo

#5 Post by Ocalabob » 04 Feb 2013 08:08

Greetings parthe and welcome to the forum.

You may want to consider opening a new thread (subject) and post your
question and provide more details as to your particular problem. Use
foxidrive's reply as a guide.

The solution may be found using ROBOCOPY so including information about
your OS would also be helpful. Maybe you'll get lucky! :)

Best wishes!

Ocalabob
Posts: 79
Joined: 24 Dec 2010 12:16
Location: Micanopy Florida

Re: Copy files that were created yesterday to parent directo

#6 Post by Ocalabob » 04 Feb 2013 08:18

@foxidrive Oops, I didn't see your post. Didn't mean to 'step' on your reply.

Later.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Copy files that were created yesterday to parent directo

#7 Post by foxidrive » 04 Feb 2013 08:24

No problemo Ocalabob.

We'll wait to see if the person replies or starts a new thread. Details, details, details, the Devil is in the details. :)

Post Reply