Input/Output (IO)

File manipulation

  io.file.delete test.txt // *.txt // also io.file.remove and io.file.erase
  io.file.join test.txt test1.txt test2.txt … // is saved in test.txt, test.txt need not be empty
  io.file.copy a.txt b.txt // a.txt.gz decompress a.txt | a.txt compress a.txt.gz
  io.file.copy.to a.txt newfolder/
  io.file.move a.txt b.txt // a.txt is deleted // a.txt.gz decompress a.txt | a.txt compress a.txt.gz
  io.file.move.to a.txt newfolder/
  io.file.rename a.txt b.txt

File list (Note: File list use Dir list to find files)

  io.files.clear // clear list
  io.files.new *.* // also io.files
  io.files.fromfile “list.txt” // get files from text file
  io.files.add *.txt // add files to list
  io.files.add.fromfile “list.txt” // add files from text file
  io.files.sub test.txt // delete file from list
  io.files.subweak test // delete files (with pattern) from list

  io.files.first // go to the first entry – see also io.files.get…
  io.files.next // go to the next entry – see also io.files.get…
  io.files.next “10.” // go to the next entry with pattern 10. – see also io.files.get…
  io.files.before // go to the previous entry – see also io.files.get…
  io.files.last // go to the last entry – see also io.files.get…
  io.files.sort
  io.files.sort.real
  io.files.sort.size
  io.files.sort.date
  io.files.flip // flip order

  io.files.replacetxt ‘old’ ‘new’ // replace in files pattern ‘old’ into ‘new’

// the following variables are filled with files.first (automatically for each list change), files.next, files.before and files.last
  io.files.get // get full name
  io.files.getprec // get n-1 full filename
  io.files.getfile // only full filename (test.txt)
  io.files.getsucc // get n+1 full filename
  io.files.getdir // only directory (folder)
  io.files.getname // only filename (test)
  io.files.getextension // only extension (txt)
  io.files.length
  io.files.rest

Directory manipulation

  io.dir.make folder1
  io.dir.delete folder1 // also io.dir.remove or io.dir.erase
  io.dir.harddelete folder1 // delete folder and files inside the folder
  io.dir.copy folder1 newfolder1
  io.dir.rename folder1 folder2
  io.dir.change folder1
  io.dir.hardchange folder1 // change folder, if it not exists it would be created

Directory (folder) list

  io.dirs.clear // clear list
  io.dirs.new a* // also io.dirs
  io.dirs.add b* // add folders to list
  io.dirs.complete /a/ // complete dirs
  io.dirs.complete.add /b/ // add folders to list
  io.dirs.sub folder1 // delete directory from list
  io.dirs.subweak // delete folders (with pattern) from list

  io.dirs.first // go to first entry – see also io.files.get…
  io.dirs.next // go to next entry – see also io.files.get…
  io.dirs.sort
  io.dirs.sort.real // also io.dirs.number
  io.dirs.sort.date
  io.dirs.flip // flip order

  io.dirs.rnew a* // fill list with folder (recursive)
  io.dirs.radd b* // add folders (recursive) to list

// the following variables are filled with dirs.first (automatically for each list change) and dirs.next
  io.dirs.get
  io.dirs.length
  io.dirs.rest

Additional

  variable := io.workdir
  variable := io.getdir “/home/user/test.txt” 20 // /home/user
  variable := io.getfile “/home/user/test.txt” 20 // test.txt
  variable := io.getfilename “/home/user/test.new.txt” 20 // test.new (exception for *.*.gz)
  variable := io.getshortfilename “/home/user/test.new.txt” 20 // test
  variable := io.getfullfileextension “/home/user/test.new.txt” 20 // new.txt
  variable := io.getfileextension “/home/user/test.txt” 20 // txt (exception for *.*.gz)
  variable := io.getshortdir “/home/user/test.txt” 20 // /home/../test.txt

Examples

▸ File loops


io.dirs.clear io.files * // load all files into a file list   // you can use io.files.add to add more files to the file list for io.files.length // for all files   print io.workdir / io.files.getdir / io.files.getfile   io.files.next end

▸ File loops (inside dirs)


io.dirs.complete * // load all sub dirs into a dir list   // you can use io.dirs.add to add more dirs to the dir list io.files * // load all files from sub dirs into a file list   // you can use io.files.add to add more files to the file list for io.files.length // for all files   print io.workdir / io.files.getdir / io.files.getfile   io.files.next end