(05-22-2024, 06:20 PM)madscijr Wrote:Note that you can use wmic to get all sorts of attribute information on your files, easily from the command line:(05-22-2024, 05:04 PM)SpriggsySpriggs Wrote: I guess I'm going to have to become the old geezer who complains that everyone is ruining hard drives with temp files constantly.Ha!
Well in this case I was looking to see if a file changed on disk, and only access it if it changed.
I figured looking at the timestamp and size in bytes are a good way to tell.
The problem with using this SHELL method that creates a file is, it requires at least 3 disk accesses:
- one to read the attributes
- one to write them to a temp file, and
- one to read that file
- (and another if we want to delete the temp file)
Not too efficient. For a lot of cases that might not be a big deal, but for what I'm doing, it would slow things down a lot.
We have a thread somewhere to suggest new commands for QB64PE, right? Where can I suggest adding some built-in cross-platform commands to get a file's date / size / attributes (& maybe update them as well)?
Code: (Select All)
AccessMask=1507775
Archive=FALSE
Caption=Z:\foo.pdf
Compressed=TRUE
CompressionMethod=Compressed
CreationClassName=CIM_LogicalFile
CreationDate=20240518233126.540393-240
CSCreationClassName=Win32_ComputerSystem
CSName=LAPTOP
Description=Z:\foo.pdf
Drive=z:
EightDotThreeFileName=z:\foo.pdf
Encrypted=FALSE
EncryptionMethod=
Extension=pdf
FileName=foo
FileSize=34339
FileType=pdf File
FSCreationClassName=Win32_FileSystem
FSName=NTFS
Hidden=FALSE
InstallDate=20240518233126.540393-240
InUseCount=
LastAccessed=20240522175359.607566-240
LastModified=20240501171800.893675-240
Manufacturer=
Name=Z:\foo.pdf
Path=\
Readable=TRUE
Status=OK
System=FALSE
Version=
Writeable=TRUE
Code: (Select All)
$Console:Only
Shell "wmic DataFile where " + Chr$(34) + "Name='Z:\\foo.pdf'" + Chr$(34) + " list /format:list"