Skip to contents

Get files stored on virtual amigaDisks as raw data or copy as file.


# S4 method for amigaDisk,character,missing
get.adf.file(x, source, destination)

# S4 method for amigaDisk,character,character
get.adf.file(x, source, destination)

# S4 method for amigaDisk,character,ANY
get.adf.file(x, source, destination)



An amigaDisk object from which a file needs to be extracted.


Specify the source file's path on the amigaDisk object, conform Amiga specs. See current.adf.dir for details on these specs.


either a file name or a file connection, that allows writing binary data (see e.g., file or url). When the destination is missing, the file content is returned as raw data.


Returns a vector of raw data when the argument destination is missing. Otherwise returns nothing.


Amiga DOS formatted disks can store any kind of file (as long as the disk's capacity allows it). Use this method to extract such files embedded in an Amiga Disk File (ADF) as raw data or copy to a file on your system.


Pepijn de Vries



if (FALSE) {
## get the file "Startup-Sequence" from the virtual
## example disk and save as a text file in the
## current working directory:
get.adf.file(adf.example, "DF0:S/Startup-Sequence", "startup.txt")

## get the same file as raw data
## by omitting the destination:
startup <- get.adf.file(adf.example, "DF0:S/Startup-Sequence")

## Look, it's a text file:
startup |> rawToChar() |> iconv(from = "ISO-8859-1", to = "UTF-8")
#> [1] "; The Startup-Sequence is executed after booting\n; Everything after semicolons are comments and is ignored\n; By default standard commands are loaded from\n; the ROM kickstart. Additional commands should be\n; stored on the disk in the SYS:C directory.\n; For demonstration purposes we only echo some\n; text to the screen... Note that this will not\n; work on Amiga OS <2.0 as \"Echo\" is not available\n; in older ROM kickstart versions.\n\nEcho \"\033c\033[22m\033[32mADF Explorer Example Disk\" ; Note that the weird characters at the start are escape-codes to format the text\nEcho \"\033[0mThis disk was created as an example for the\"\nEcho \"R package 'adfExplorer' by Pepijn de Vries.\""

if (requireNamespace("ProTrackR", quietly = TRUE)) {
  ## look there is a typical ProTracker module on
  ## the example disk. You can load it like this:
  ## get the file from the virtual disk
  ## as raw data
  mod.raw <- get.adf.file(adf.example, "DF0:mods/mod.intro")

  ## open a raw connection with the
  ## newly imported raw data
  con <- rawConnection(mod.raw, "rb")

  ## and read it as a ProTracker module
  mod <- ProTrackR::read.module(con)
  ## plot the first sample from the module:
  plot(ProTrackR::waveform(ProTrackR::PTSample(mod, 1)),
       type = "l", ylab = "amplitude")
} else {
  cat("You need to install and load the\nProTrackR package for this part of the example.")