Hi, back again.
I made up a small util, "updater.bat" that searches through a selected topmost folder and all sub-folders.
The purpose is to update any files found in the searched folders that matches the "input file" to "Updater", if they are older.
I have a need for this and the util works fine for my purpose.
I have a counter that counts the number of folders searched, I display this in the TITLE bar of the CMD window, very small hit on processing time.
Ideally I would like to have the option to use a second counter !_FILES_FOUND! that would count the number of files matching the "input file" in all of the folders.
This wouldn't indicate how many were updated, thats probably not possible, but at least it would be nice to know how many there were.
I'm not sure how to do this, I tried the line below but ( IF EXIST %~n1%~x1 SET /A _FILE_FOUND+=1 ) it never goes above 0.
Thanks in advance.
Meant to say, the !_FOLDERS_TO_PROCESS! is a variable representing for example D:\Photos\*.*
%~f1 is the input file, dragged and dropped.
@echo off
cls
Setlocal EnableDelayedExpansion
SET /A _COUNTER=0
SET /A _FILE_FOUND=0
for /f "tokens=*" %%G in ('DIR /b /s /a:d "!_FOLDERS_TO_PROCESS!"') DO (
xcopy /d /u /y /v /q "%~f1" "%%G\">nul
SET /A _COUNTER+=1
IF EXIST %~n1%~x1 SET /A _FILE_FOUND+=1
TITLE Updater. Folders searched = [ !_COUNTER! ]. Folders to process = [ !_FOLDERS_TO_PROCESS! ]. File to replace = [ %~n1%~x1 ].
)
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 2 of 2
Thread
Similar Threads
-
How to make a video from a counter?
By ziptip in forum EditingReplies: 14Last Post: 16th Dec 2021, 12:43 -
Getting an accurate frame count for whole video
By Fern99 in forum Newbie / General discussionsReplies: 9Last Post: 29th Jun 2021, 17:12 -
how to add time counter of exist video file ?
By yanshof in forum ProgrammingReplies: 4Last Post: 10th May 2019, 02:57 -
How to eliminate a hotmail count
By XPTO in forum ComputerReplies: 4Last Post: 28th Apr 2019, 17:45 -
How can I check the frame count of my video (without MediaInfo)?
By synnchan in forum Newbie / General discussionsReplies: 10Last Post: 26th Dec 2018, 20:13