Here is the script I used to copy the files via GPIB in case anyone else does not want to take out the hard drive or insert a floppy disk and press buttons lots of times. It copies all files in the computer's current working directory to the oscilloscope's hard drive root. The speed is about 3.15 KB/s using a Xyphro GPIB adapter.
#!/usr/bin/python3
import pathlib
import re
import sys
import pyvisa
match_filename_byte = "[-0-9A-Z !#$%&'()@^_`{}~]"
match_filename_basename = (
match_filename_byte + r"{1,8}(?:\." + match_filename_byte + "{,3})?"
)
match_filename = re.compile(
match_filename_basename + "(?:/" + match_filename_basename + ")*"
)
def query_id(log=False):
idn = handle.query("*IDN?").rstrip()
if log:
print("idn", idn, file=sys.stderr)
assert re.match(r"\Atektronix,\s*tds [5-7][0-9]{2}d,", idn, re.I)
resources = pyvisa.ResourceManager()
devices = resources.list_resources()
print("available", devices, file=sys.stderr)
devices = [name for name in devices if name.find("::TEKTRONIX_TDS_") >= 0]
assert len(devices) == 1
handle = resources.open_resource(devices[0])
query_id(True)
handle.write("FILESYSTEM:OVERWRITE OFF")
query_id()
for root, dirs, files in pathlib.Path(".").walk():
for basename in dirs:
name = str(root / basename)
print("dir", name, file=sys.stderr)
assert match_filename.fullmatch(
name,
)
handle.write(f'FILESYSTEM:MKDIR "hd0:/{name}"')
query_id()
for basename in files:
path = root / basename
name = str(path)
print("write", name, file=sys.stderr)
assert match_filename.fullmatch(name)
with path.open("rb") as fh:
content = fh.read()
size = str(len(content))
handle.write_raw(
f'FILESYSTEM:WRITEFILE "hd0:/{name}", #{len(size)}{size}'.encode(
"us-ascii"
)
+ content
)
query_id()