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 renamefnSearchStr (
str) – string specifier to find files to renameoldchar (
str) – string to replace in old filenamesnewchar (
str) – replacement string in new filenamesdryrun (
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 renamefnSearchStr (
str) – string specifier to find files to renameoldchar (
str) – string to replace in old filenamesnewchar (
str) – replacement string in new filenamesdryrun (
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 renamefnSearchStr (
str) – string specifier to find files to renameoldchar (
str) – string to replace in old filenamesnewchar (
str) – replacement string in new filenamesdryrun (
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 filedat (
array) – the data to write to diskheader (
char) – the header string for the txt file2019 (
NPMitchell) –