Creating a .bat file for automated moving of files via Scheduled Tasks in Win7HP x64 - AVS Forum
Forum Jump: 
 
Thread Tools
post #1 of 8 Old 05-01-2013, 05:31 PM - Thread Starter
Advanced Member
 
Vlad Theimpaler's Avatar
 
Join Date: Aug 2006
Posts: 804
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 33
Hi again, all smile.gif

I have a custom built HTPC/DVR in the living room that runs under Windows 7 Home Premium SP1 x64.

I would like to configure the HTPC so that it automatically moves DVR recordings off of the capture hard drives and places them onto another local hard drive. That is, I want to have daily unattended "cut-and-paste" of .ts files from one local hard drive (used for placement of DVR recordings) to another local hard drive (used as a big storage space).

My HTPC/DVR has access to 6 ASTC tuners, and contains multiple internal disk drives which are set up as follows under Win7:

C:\ = NTFS partition on a 128GB SSD used for OS and programs.

E:\ = NTFS partition on a 1TB HDD used as a landing space for recordings made with OTA Tuners 1,2,3.

F:\ = NTFS partition on a 1TB HDD used as a landing space for recordings made with OTA Tuners 4,5,6.

G:\ = NTFS partition on a 4TB HDD used as a large buffer space available for when drives E: and F: start getting full.

What I wish to do, specifically, is the following:

Move *.ts from E: to G:\BUFFER_FOLDER1\, and then...
move *.ts from F: to G:\BUFFER_FOLDER2\.

I figure that this can easily be achieved with a .bat file that is executed daily using Scheduled Tasks in Windows 7. So if anyone has any .bat scripts they could share here, that would be great. Thanks.

Vlad Theimpaler is offline  
Sponsored Links
Advertisement
 
post #2 of 8 Old 05-01-2013, 06:04 PM
AVS Special Member
 
amarshonarbangla's Avatar
 
Join Date: Mar 2011
Posts: 1,239
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 39
http://www.howtogeek.com/howto/25046/schedule-synctoy-to-run-automatically-with-task-scheduler-in-windows-7

Or you could try PureSync which has a scheduler built-in.
amarshonarbangla is offline  
post #3 of 8 Old 05-02-2013, 08:32 AM - Thread Starter
Advanced Member
 
Vlad Theimpaler's Avatar
 
Join Date: Aug 2006
Posts: 804
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 33
Quote:
Originally Posted by amarshonarbangla View Post

http://www.howtogeek.com/howto/25046/schedule-synctoy-to-run-automatically-with-task-scheduler-in-windows-7

Or you could try PureSync which has a scheduler built-in.

Thanks amarshonarbangla. Looked at both suggestions, but I need the files moved rather than copied. The sync tools would be perfect if copying the *.ts files was the goal. I suppose I could set up the sync to occur automatically at a certain time and then manually delete the original files off the DVR HDDs, but I would prefer that the whole process be carried out automatically.

*EDIT*
Actually, I could use the sync utility to make copies, then use a .bat script (+Task Scheduler) to automatically delete the originals afterwards... maybe that's the way to go for my particular need smile.gif

Thank you again for your reply.

Vlad Theimpaler is offline  
post #4 of 8 Old 05-02-2013, 10:54 AM - Thread Starter
Advanced Member
 
Vlad Theimpaler's Avatar
 
Join Date: Aug 2006
Posts: 804
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 33
Found a site through Googling that shows command script definitions, syntax, and examples. From reviewing that site, it looks like the MOVE command is what I need.

Source
http://www.scriptcode.com/batchfilecommands/move.html

According to the web page found at the above link:
Quote:
MOVE - Batch File Command

Moves files from one location to another, as opposed to copying. The MOVE command combines COPY and DELETE by copying a file then deleting the original.

Syntax

move [{/y|/-y}] [Source] [target]

Parameters

/y : Suppresses prompting to confirm you want to overwrite
an existing destination file.

/-y : Causes prompting to confirm you want to overwrite an
existing destination file.

Source : Specifies the path and name of the file or files
to move. If you want to move or rename a
directory, Source should be the current directory
path and name.

target : Specifies the path and name to move files to. If
you want to move or rename a directory, target
should be the desired directory path and name.

Examples

MOVE C:\test.txt A:\test.txt, moves the file "test.txt" from
C:\ to the A: drive.

To move all files with the .xls extension from the \Data
directory to the \Reports directory, type the following:

MOVE \data\*.xls \reports\

You may also use MOVE to rename files in the new location.

Example: MOVE C:\test.txt C:\windows\myfile.txt creates a
copy with a new name and deletes the original. Copies and
deletes a file at the same time.

So in order to do what I wrote in my original post:
Quote:
Move *.ts from E: to G:\BUFFER_FOLDER1\, and then...
move *.ts from F: to G:\BUFFER_FOLDER2\.

I should use the following command lines:
Quote:
move e:\*.ts g:\buffer_folder1\
move f:\*.ts g:\buffer_folder2\

When I have a spare moment, I will create the above command script and save it to a batch file, then run it. I'll report back later with the outcome in case anyone is interested smile.gif

Vlad Theimpaler is offline  
post #5 of 8 Old 05-02-2013, 11:22 AM
AVS Special Member
 
amarshonarbangla's Avatar
 
Join Date: Mar 2011
Posts: 1,239
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 39
Puresync has an option to delete files from the original location upon moving.
amarshonarbangla is offline  
post #6 of 8 Old 05-02-2013, 01:43 PM
Member
 
glorpsd's Avatar
 
Join Date: Apr 2009
Posts: 100
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 14
Quote:
Originally Posted by Vlad Theimpaler View Post

Found a site through Googling that shows command script definitions, syntax, and examples. From reviewing that site, it looks like the MOVE command is what I need.

Source
http://www.scriptcode.com/batchfilecommands/move.html

According to the web page found at the above link:
So in order to do what I wrote in my original post:
I should use the following command lines:
When I have a spare moment, I will create the above command script and save it to a batch file, then run it. I'll report back later with the outcome in case anyone is interested smile.gif

You might want to also Google "robocopy". Just sayin'.
Sammy2 likes this.
glorpsd is offline  
post #7 of 8 Old 05-02-2013, 02:07 PM - Thread Starter
Advanced Member
 
Vlad Theimpaler's Avatar
 
Join Date: Aug 2006
Posts: 804
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 33
Quote:
Originally Posted by glorpsd View Post

You might want to also Google "robocopy". Just sayin'.

Excellent, thank you, glorpsd, for helping me learn about something new smile.gif

When I reviewed the Wikipedia article at:
http://en.wikipedia.org/wiki/Robocopy

I noticed this statement:
Quote:
File names and wild-card characters (such as "*.*") are not valid source or destination arguments.

This limitation is, unfortunately, a dealbreaker for me. I do appreciate the response, though, and hope to hear from others with additional options. Thank you everybody.

Vlad Theimpaler is offline  
post #8 of 8 Old 05-02-2013, 02:20 PM
Member
 
glorpsd's Avatar
 
Join Date: Apr 2009
Posts: 100
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 14
Wildcard example in DOS:
Quote:
...
ECHO Start ROBOCOPY to '\\whs\Recorded TV' >>D:\Media\robotv-%COMPUTERNAME%.log
FOR /F "usebackq delims=|" %%i IN (`dir /b "D:\Media\RecTV\*.wtv"`) DO IF NOT EXIST "\\whs\recorded tv\%%i" RENAME "D:\Media\RecTV\%%i" "%%~n%i.wtv-temp"
robocopy "D:\Media\RecTV" "\\whs\recorded tv" *.wtv-temp /LOG+biggrin.gif:\Media\robotv-%COMPUTERNAME%.log /COPYALL /R:5 /NP
ren "\\whs\recorded tv\*.wtv-temp" *.wtv >>D:\Media\robotv-%COMPUTERNAME%.log
ren "D:\Media\RecTV\*.wtv-temp" *.wtv >>D:\Media\robotv-%COMPUTERNAME%.log
FOR /F "usebackq delims=|" %%i IN (`dir /b "D:\Media\RecTV\*.wtv"`) DO IF EXIST "\\whs\recorded tv\%%i" DEL "D:\Media\RecTV\%%i" "%%~n%i.wtv"
...
glorpsd is offline  
Reply Home Theater Computers

User Tag List

Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page


Forum Jump: 

Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off