n=change_fnames(recdir,prefix,newprefix)  %Matlab & Octave
#R to do

Change the names of files in a directory. This is useful for changing the names of a set of files from a tag deployment to a different format. Only the first part of the name matching the prefix is changed - any trailing letters or numbers are kept. Careful: things can go very wrong when messing with valuable data files. Always do a check first on some dummy files. There may also be better ways to do re-naming operations through your operating system.

Input var Description Default
recdir is a string containing the full or relative (to the current working directory) pathname of the directory where the files are stored.N/A
prefix is a string containing the part of the file name to be changed.N/A
newprefix is a string containing the replacement.N/A
Output var Description Units
n is the number of files that were re-named. N/A

Matlab & Octave

change_fnames('/tag/data/zc17','zc17_173a','zc17_172a') % renames all files in /tag/data/zc17 called zc17_173a* to zc17_172a*.

R

# to do # renames all files in /tag/data/zc17 called zc17_173a* to zc17_172a*.

bugs@animaltags.org Last modified: 12 July 2017

  • tagwiki/tools/io/change_fnames.txt
  • Last modified: 2017/08/05 11:09
  • by funkyfinwhale