:DISK:FILE:SIZE?
Instrument:
N1000A
DCA-M
Meas. mode:
Scope
Eye
Jitter
TDR
Flex Apps:
FlexDCA
FlexRT
Query Syntax
:DISK:FILE:SIZE? "filename"
Description
Returns the size of a file in bytes. To determine if a file exists, use the :DISK:FILE:EXISTs?
query. If file does not exists, 0 is returned. To return a time stamp for the file, use the :DISK:FILE:TIMestamp?
query.
Requires FlexDCA revision A.05.30 and above.
Example
This Python script (with PyVISA) tests if a specific screen image file exists and returns its size in bytes.
# -*- coding: utf-8 -*- """ Checks is file exists and returns its size in bytes. """ import visa rm = visa.ResourceManager('C:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\agvisa\\agbin\\visa32.dll') FlexDCA = rm.open_resource("TCPIP0::localhost::hislip0::INSTR") #Set Timeout - 10 seconds FlexDCA.timeout = 10000 FlexDCA.read_termination = '\n' filePath = '"%USER_DATA_DIR%\\Screen Images\\screenimage.png"' if FlexDCA.query(':DISK:FILE:EXISts? ' + filePath) == '1': print('File exists!') size = FlexDCA.query(':DISK:FILE:SIZE? ' + filePath) print('File is ' + size + ' bytes') else: print('File not found.') FlexDCA.write(':SYSTem:GTLocal') FlexDCA.close()