Skip to content

Commit

Permalink
rename_files function
Browse files Browse the repository at this point in the history
  • Loading branch information
scovitz1 committed Oct 8, 2020
1 parent 1886891 commit ff54f28
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions bond/bond.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
"""Main module."""

import pathlib

class BOnD(object):

def __init__(self, data_root):
self.path = data_root

def fieldmaps_ok(self):
pass

def rename_files(self, pattern, replacement):
pass
def rename_files(self, path_to_dir, pattern, replacement):
for path in pathlib.Path(path_to_dir).iterdir():
if path.is_file():
old_name = path.stem
old_ext = path.suffix
directory = path.parent
new_name = old_name.replace(pattern, replacement) + old_ext
path.rename(pathlib.Path(directory, new_name))

def find_param_sets(self, pattern):
pass
Expand Down

0 comments on commit ff54f28

Please sign in to comment.