In Delphi code, call FileSize to determine the size of the file specified by the file variable F. The size is expressed as the number of records in a record file. Thus: If the file is declared as a file of byte, then the record size defaults to one byte, and FileSize returns the number of bytes in the file. In Delphi code, call FileSize to determine the size of the file specified by the file variable F. The size is expressed as the number of records in a record file. Thus: If the file is declared as a file of byte, then the record size defaults to one byte, and FileSize returns the number of bytes in the file. But for a ZIP file, the size of the file IS the size of the archive. For a file on a compressed volume it will report the size of the decompressed file, which is what you want because you are asking for the size of the storage object (the file) not the physical storage medium (the OS enforced compression). How to check in bash if file size is greater than N. Shell find bash. You can do this using the find command and the. (find /path/to/file -type f -size +51200c 2>/dev/null) ]]; then somecmd fi. Written by Janos Gyerik. Respond 3 Responses Add your response. November 09, 2014 14:28.
My app contains documents in its database. The users can open the documents in which case, the document gets saved to a temporary folder and gets opened on the user's computer.
- Delphi Basics: FileExists Function: Returns true if the given file exists. Check for a file before and after deleting it. // Now see if the file exists if FileExists(fileName) then ShowMessage(fileName+' exists OK') else ShowMessage(fileName+' does not exist').
- All Databases Data & log file size, space used & free space This SQL script will helpful for daily checklist, incase of no any third party tool is available for database monitoring. Script will produce the all database size, status, recovery model, data & log file size, spaceused & free space details.
I'd like to get a notification when one of these temporary files are changed, and offer the user to save the changed document back to the database.
What is the most simple way to do this in Delphi7? (I suppose it requires some shell magic or 3rd party component)
Thanks!
RRUZ4 Answers
You can either:
use the Win32 API SHChangeNotifyRegister function to watch for changes in the temp folder, and then have your callback check if your temporary files are reporting changes.
since you know the exact file(s) you are interested in, you can manually monitor them directly for changes to their sizes and timestamps using FindFirstFile in a timer or thread.
You can detect changes in your temporary files (or any file) using the TJvChangeNotify
component from the JEDI JVCL collection.
In addition to what RRuz and Remy Lebeau wrote:
Note that TJvChangeNotify
in the JvChangeNotify
unit makes use of the FindFirstChangeNotification
API call; this is the MSDN documentation. Note it is a bit counter-intuitive: see the thread mentioned below on how to use it inside a while loop.
There is also the ReadDirectoryChanges
API call, which is not wrapped by the JCL/JVCL, and has MSDN documentation here and there is a Delphi win32 example as well.
This thread explains the differences between the two API calls.
--jeroen
Also take a look at this: http://www.cromis.net/blog/downloads/directory-watch/ and How to monitoring directory for files in Delphi XE?