basics#

Example Usage#

Full Contents:#

basics.demo_renameBatchFilesSubSubdirs#

DEMO FOR renameBatchFilesSubSubdirs

basics.ensureDir(dirpath)#

ENSUREDIR(dirpath) create a directory if it does not exist already

Parameters

dirpath (str) – The path to create if it does not exist

Returns

  • dirpath (str) – Returns the input, for convenience

  • NPMitchell 2019

basics.getsize(this)#
GETSIZE Show the size on disk of an object.

Only works if the properties GetAccess method is set to public

NPM 2019

basics.linecount(fid)#

count lines in the file with fileID fid

basics.renameBatchFiles(directory, fnSearchStr, oldchar, newchar, dryrun)#

change (batch) file names

Parameters
  • directory (str) – path to file to rename

  • fnSearchStr (str) – string specifier to find files to rename

  • oldchar (str) – string to replace in old filenames

  • newchar (str) – replacement string in new filenames

  • dryrun (optional bool, default=false) – do not actually replace files, just test I/O

Returns

  • <none>

  • NPMitchell 2020

basics.renameBatchFilesSubSubdirs(directory, fnSearchStr, oldchar, newchar, dryrun)#

change (batch) file names in every subdir of a directory

Parameters
  • directory (str) – path of grandparent directory of file to rename

  • fnSearchStr (str) – string specifier to find files to rename

  • oldchar (str) – string to replace in old filenames

  • newchar (str) – replacement string in new filenames

  • dryrun (optional bool, default=false) – do not actually replace files, just test I/O

Returns

  • <none>

  • Example Usage

  • ————-

  • direc = ‘/Volumes/minimalData/Atlas_Data/WT/’ ;

  • fnSearchStr = ‘timematch_curve7_.*’ ;*

  • oldchar = ‘timematch_curve7_’ ;

  • newchar = ‘timematch_Runt_Runtstripe7_’ ;

  • dryrun = true ;

  • renameBatchFilesSubSubdirs(direc, fnSearchStr, oldchar, newchar, dryrun)

  • NPMitchell 2020

basics.renameBatchFilesSubdirs(directory, fnSearchStr, oldchar, newchar, dryrun)#

change (batch) file names in every subdir of a directory

Parameters
  • directory (str) – path to file to rename

  • fnSearchStr (str) – string specifier to find files to rename

  • oldchar (str) – string to replace in old filenames

  • newchar (str) – replacement string in new filenames

  • dryrun (optional bool, default=false) – do not actually replace files, just test I/O

Returns

  • <none>

  • Example Usage

  • ————-

  • directory = ‘/Volumes/minimalData/Atlas_Data/WT/’

NPMitchell 2020

basics.subdirs(directory, subdirs2ignore)#

SUBDIRS(directory, subdirs2ignore)

NPMitchell 2020

basics.write_txt_with_header(fn, dat, header)#

WRITE_TXT_WITH_HEADER(FN, DAT, HEADER) Write data to a txt file with header

Parameters
  • fn (char) – the filename (full path) of the txt file

  • dat (array) – the data to write to disk

  • header (char) – the header string for the txt file

  • 2019 (NPMitchell) –

Indices and tables#