Computing.Net > Forums > Programming > want to record a file size daily...

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

want to record a file size daily...

Reply to Message Icon

Name: mqa
Date: March 1, 2004 at 07:08:25 Pacific
OS: windows 2000
CPU/Ram: intel
Comment:

I want a program that will go out and get the size of a certain file every day and append it to a text file. I'll then have a running record of the changes in this files size.

The file is a backup that starts with the same characters each time, but there are numbers on the end of the file that change every day. I was thinking a .bat file in scheduler would do the trick? Can it be done?



Sponsored Link
Ads by Google

Response Number 1
Name: dtech10
Date: March 1, 2004 at 16:33:49 Pacific
Reply:

Hi
We meet again
Try this. Not sure about scheduler as I never use it.
but I don't see why not.

@echo off
rem example file
dir > filename001

rem find file folowerd by 3 digits save into tmp.txt
dir /b | findstr /i "filename[0-9][0-9][0-9]" > tmp.txt
for /f %%a in (tmp.txt) do echo %%~za >> logfile.txt



0

Response Number 2
Name: mqa
Date: March 2, 2004 at 08:46:33 Pacific
Reply:

We do meet again. You're on the wrong time zone though!

That code works great. How would I add a date to that? Also, will this append each new file to the logfile.txt record? I ask because if I run it everyday and the old file that was added yesterday is deleted, will it stay in the logfile.txt? I need it to.

To be clear. Every day, a new file is created replacing the old file. If I don't record the information from the old file before the new file is created, it's lost forever.


0

Response Number 3
Name: dtech10
Date: March 2, 2004 at 12:52:29 Pacific
Reply:

Hi
Yes as long as the filename as the same format ie FilenameNNN or whatever.
By date I take it to mean system date and not file date.
This code will echo to the logfile the
Date,Time,Filename and Size.

for /f %%a in (tmp.txt) do echo %date%
%time% %%~na %%~za >> logfile.txt


0

Response Number 4
Name: dtech10
Date: March 2, 2004 at 12:59:17 Pacific
Reply:

Hi
buy the way in your other thread the count wount'nt work because I missed off the percent sign it should have been
ie set /a Count=%Count%+1


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Automating window switchi... images in SDL



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: want to record a file size daily...

Batch Script To FTP a file www.computing.net/answers/programming/batch-script-to-ftp-a-file/17008.html

C++ how to patch a file? www.computing.net/answers/programming/c-how-to-patch-a-file/15027.html

Using parameters to rename a file www.computing.net/answers/programming/using-parameters-to-rename-a-file/15005.html