Solved Conditional backup based on contents and date

October 6, 2013 at 00:26:02
Specs: Windows 7
I need something that will monitor a directory, and periodically(i.e. every few seconds) copy to another directory any files that have :
1. Changed since last time.
2. Contain a specific string.

Perhaps a program, a batch script or something else? Or it doesn't even have to be automatic. I can run it manually. As long as it satisfies the above 2 conditions it should be fine.


See More: Conditional backup based on contents and date

Report •


#1
October 6, 2013 at 04:35:02
✔ Best Answer
::======  script starts here  ===============
:: 
:: matrixy.bat  2013-10-06 18:24:23.50
@echo off & setLocal enableDELAYedeXpansioN

for /f "tokens=* delims= " %%a in ('xcopy /L /D D:\files\*.txt %TMP%\ ^| find "."') do (
find "my string" < "%%a" > nul
if not errorlevel 1 echo xcopy "%%a" %TMP%\
)
::======  script ends here  =================

=====================
M2 Golden-Triangle

message edited by Mechanix2Go


Report •

#2
October 6, 2013 at 08:35:09
Hm.. Thanks for that.
I'm a little fuzzy on the details though. And I generally wanna make sure I understand that stuff. The "Give a man a fish..." deal.

Which is the source and which the destination?
What is this bit "^|"? Logic operators?
" < "%%a" >" ?
nul or null?


Report •

#3
October 7, 2013 at 01:01:15
That's your homework assignment.

=====================
M2 Golden-Triangle


Report •

Related Solutions

#4
October 7, 2013 at 06:19:48
Suggested reading - Output redirection: http://technet.microsoft.com/en-us/...
Suggested reading - Special characters: http://technet.microsoft.com/en-us/... (Maybe about 1/8 of the way through)

How To Ask Questions The Smart Way


Report •

#5
October 7, 2013 at 21:10:54
Hi R2,

OT [sorta] Is the a site which provides a 'vitual NTVDM prompt'?

It would be real handy for someone running, let's say, android.

=====================
M2 Golden-Triangle


Report •

#6
October 8, 2013 at 06:32:33
None that I could find. You could probably set up an SSH server on an x86 box, and use an Android SSH client.

How To Ask Questions The Smart Way


Report •


Ask Question