# Batch file help



## tex_waco_usmc (Jan 23, 2012)

Pounding my head against the wall on a batch file that I need to create. 

Daily on the system I am working with a folder is created using the Julian Date as the folder name (Ex: 2012_23)... Those folders stay on the computer until I physically go in and delete them. 

What I need to do now is create a batch file that can look for the folder that has the newest Julian date as the name and then copy all files within that folder that have a date/time modified in the previous 3 hours (roughly 3500 files every 3 hours). I have been doing this manually for months now and it is getting old. This batch file would be run every 3 hours using the Scheduled Tasks on the computer. But I cant figure out how to write the batch file and am now reaching out for some help... Any and all help would be greatly appreciated!


----------



## tex_waco_usmc (Jan 23, 2012)

Does this make sense to you all or is it not clear?


----------



## tex_waco_usmc (Jan 23, 2012)

ok, so I guess to get started... 

I can use xcopy to copy the files and move them, and I can use it to only pull the file types that I want and not the ones that I dont want. But how would I go about making it look in the right folder and only pull the past three hours worth of files? Any help is greatly appreciated...


----------



## Squashman (Apr 4, 2003)

Batch is not the greatest tool to use for a job like this.
There are plenty of scripts out there that do this by file age in days but it becomes increasingly more difficult when the TIME is involved especially if now have to look back 3 hours from the previous day once midnight hits.

I am not a VBscript expert but I believe it would be easier to calculate the 3 hour difference using VBscript vs a batch file. That is just from what I have researched and read.


----------



## Squashman (Apr 4, 2003)

Take a look at this thread.
http://www.dostips.com/forum/viewtopic.php?f=3&t=2925


----------

