|
Answer» Hello i trying to make a SCRIPT to monitor the size folder every hour and cant : any help will apreciated.
i need something like this:
script one: 1-chek the actual size of the folder and write the size to a txt file.(in a remote pc like: \\pc2\folder1 )
script two 2-read the file size from the txt and compare with the actual folder size , if size was changed - close the script. if size not changed open url.
why 2 scripts ? because i want to use the windows schedule,. thank you very much!Here you go.
The first file is named "FileSize.bat"
@echo off setLocal EnableDelayedExpansion set /a value=0 set /a sum=0 FOR /R %1 %%I IN (*) DO ( set /a value=%%~zI/1024 set /a sum=!sum!+!value! ) echo !sum! > Size.txt pause
The file MAKES a text file named "size.txt"
The second file is name "Compare.bat"
@echo off setLocal EnableDelayedExpansion set /a value=0 set /a sum=0 FOR /R %1 %%I IN (*) DO ( set /a value=%%~zI/1024 set /a sum=!sum!+!value! )
for /f "Delims=" %%A in (%~dp0Size.txt) do ( set SIZE=%%A )
if %SIZE%==!sum! ( start YOUR_URL__GOES_HERE & pause ) else ( Exit )
If you DONT wish to DISPLAY the prompt during execution you could add a third file to run the batch file invisibly. This file is named "Invisible.vbs" don't use the (.bat) extension on this file, only use the (.vbs) extension.
Set WshShell = CreateObject("WScript.Shell" ) WshShell.Run chr(34) & "FileSize.bat" & Chr(34), 0 Set WshShell = Nothing
Place all files in the same directory. Your welcome
|