ie8 fix

Coding & scripting forum: Need Help with Refining a Batch File.

by: DinaMiles April 20, 2011 10:32 PM PDT

Like this

0 people like this thread

Staff pick

Resolved question

Need Help with Refining a Batch File.

by DinaMiles - 4/20/11 10:32 PM

I have a "black box" unit that will be installed in a vehicle, which records
digital video onto an SD Card.

The black
box unit records in three-minute segments, creating and automatically naming
the files; Windows automatically gives them a time/date stamp.

Once the memory capacity of the SD Card is
reached (approximately 12 hours), the black box begins overwriting the earliest
time/date stamped files. The black box
is 'always on', so it records 24/7.

I
plan, at the end of each day to copy/archive onto a computer's internal slave
drive all of the DVR recordings off the SD Card from that day, but only those
files that were created between 07:00 (AM) and 17:00 (PM).

Once the task of copying/archiving the
files is completed: (A) All the data files contained within the
folder "EventList" on the SD Card are to be deleted; then (B) the entire folder
and files contained in "FileList_ ? [date/time]" (e.g., FileList_20101117_191021) are also to be deleted.




Therefore, I'm trying to create a batch file
that will accomplish the following tasks:




1) Create a new subfolder on a PC's internal fixed slave drive [E:\], and
name it with the current day's date (e.g., 11192010)




2) Copy the only those folders and files on the SD Card [F:\], created each
day between 07:00 and 17:00, to the newly-created subfolder on the fixed slave
drive [E:\].




3) Delete all the files within a folder titled "EventList" on the SD Card
[F:\], so that it becomes an empty folder.




4) Completely delete the second folder on the SD Card, which is
automatically created/named each day by the "Black Box" (e.g.,
"FileList_20101117_191021"); this hardware-generated name is a combination of
the date and time.




I believe I've been able to create (with much assistance) a batch file
that accomplishes all four tasks, with the exception of only copying only those
files created on the day between 07:00 and 17:00. Here's what I have so far:



============================================================


@echo off
for /F " tokens=1,2,3* delims=/, " %%i IN ('date /T') DO (
set CUR_DAY_OF_WEEK=%%i
set CUR_MONTH=%%j
set CUR_DAY=%%k
set CUR_YEAR=%%l)


for /F " tokens=1,2,3* delims=:, " %%i IN ('time /T') DO (
set CUR_HOUR=%%i
set CUR_MIN=%%j
set AM_PM=%%k)


MD "e:\blackbox\ford2000\%CUR_MONTH%%CUR_DAY%%CUR_YEAR%


xcopy "f:\"
"e:\blackbox\ford2000\%CUR_MONTH%%CUR_DAY%%CUR_YEAR%" /D /E /C /R /I
/K /Y


echo y | del
f:\EventList\*.*


@echo off & setLocal EnableDELAYedeXpansion

for /f "tokens=* delims= " %%a in ('dir/b/s/ad f:\filelist*.*') do (
xcopy %%~DPNa e:\%%~Na\ /s
rd /s /q %%a
)


============================================================

If it is possible to do so, can anyone please help me restrict the xcopy process to only those
folders/files created on the day between 07:00 and 17:00? I would be greatly appreciative of the
assistance, as it would help save hard disk space (not to mention copying time)
by not archiving those folders/files created outside of the aforementioned time
parameter.




Thanks,




Dina Miles

Forum Icon Legend

  • UnreadUnread
  • ReadRead
  • Locked threadLocked thread
  •   
  •   
  •   
  •   
  •   
  •   
  •   
  • ModeratorModerator
  • CNET StaffCNET Staff
  • Samsung StaffSamsung Staff
  • Norton Authorized Support TeamNorton Authorized Support Team
  • AVG StaffAVG Staff
  • avast! Staffavast! Staff
  • Webroot Support TeamWebroot Support Team
  • Acer Customer Experience TeamAcer Customer Experience Team
  • Windows Outreach TeamWindows Outreach Team
  • DISH staffDISH staff
  • Dell StaffDell Staff
  • Intel StaffIntel Staff
  • QuestionQuestion
  • Resolved questionResolved question
  • General discussionGeneral discussion
  • TipTip
  • Alert or warningAlert or warning
  • PraisePraise
  • RantRant

You are e-mailing the following post: Post Subject

Your e-mail address is used only to let the recipient know who sent the e-mail and in case of transmission error. Neither your address nor the recipient's address will be used for any other purpose.

Sorry, there was a problem emailing this post. Please try again.

Submit Email Cancel

Thank you. Sent email to

Close

Thank you. Sent email to

Close

You are reporting the following post: Post Subject

If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.

Offensive: Sexually explicit or offensive language

Spam: Advertisements or commercial links

Disruptive posting: Flaming or offending other users

Illegal activities: Promote cracked software, or other illegal content

Sorry, there was a problem submitting your post. Please try again.

Submit Report Cancel

Your message has been submitted and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.

Close

Your message has been submitted and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.

Close

You are posting a reply to: Post Subject

The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to the CNET Forums policies for details. All submitted content is subject to CBS Interactive Site Terms of Use.

You are currently tracking this discussion. Click here to manage your tracked discussions.

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

Sorry, there was a problem submitting your post. Please try again.

Sorry, there was a problem generating the preview. Please try again.

Duplicate posts are not allowed in the forums. Please edit your post and submit again.

Submit Reply Preview Cancel

Thank you, , your post has been submitted and will appear on our site shortly.

Close

You are requesting a clarification of the question: Post Subject

The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to the CNET Forums policies for details. All submitted content is subject to CBS Interactive Site Terms of Use.

You are currently tracking this discussion. Click here to manage your tracked discussions.

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

Sorry, there was a problem submitting your post. Please try again.

Sorry, there was a problem generating the preview. Please try again.

Submit Clarification Request Preview Cancel

Thank you, , your post has been submitted and will appear on our site shortly.

Close

You are posting an answer to the question: Post Subject

The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to the CNET Forums policies for details. All submitted content is subject to CBS Interactive Site Terms of Use.

You are currently tracking this discussion. Click here to manage your tracked discussions.

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

Sorry, there was a problem submitting your post. Please try again.

Sorry, there was a problem generating the preview. Please try again.

Submit Answer Preview Cancel

Thank you, , your post has been submitted and will appear on our site shortly.

Close
close

Click here to be notified via e-mail when someone submits an answer.

Would you like to resolve this question? close

Based on your response, it looks like this question has been answered.



Sorry, there was a problem resolving this question. Please try again.

Resolve Leave unresolved