diff --git a/pykun/__init__.py b/pykun/__init__.py index 77f55ae..079e578 100644 --- a/pykun/__init__.py +++ b/pykun/__init__.py @@ -1,7 +1,7 @@ __author__ = "kunrunic (kunrunic7272@gamil.com)" -__version__ = "0.1.2" +__version__ = "0.1.3" __copyright__ = "Copyright (c) 2021 Jho Sung Jun" __license__ = "MIT" diff --git a/pykun/file/copier.py b/pykun/file/copier.py index 269d35c..c02d6f6 100644 --- a/pykun/file/copier.py +++ b/pykun/file/copier.py @@ -192,10 +192,18 @@ def cpFilesSrcToDest( src, dest, prefix ) : pass except Exception as e: print(e) - if name.startswith(prefix) == True or prefix == False : + if name.endswith("_bk") == True : + return + def isPrefix(): + if isinstance(prefix, bool) == True: + return True + return name.startswith(prefix) + + if isPrefix() == True : srcName = "{src}/{name}".format(**locals()) destName = "{dest}/{name}".format(**locals()) if diffFile(srcName, destName) == True: + os.rename(destName, "{0}_{1}_bk".format(destName, time.strftime('%Y_%m_%d_%X', time.localtime(time.time())))) print("ok ... Copy : {srcName} -> {destName}".format(**locals())) shutil.copy2(srcName, destName) @@ -225,7 +233,7 @@ def convert(src, dest, factors): def quickHelp(): print("Usege : copier [ option ] [ option arg ]") print("Option :") - print("> cp - inputs [ src, dest, prefix ] ") + print("> diffcp - inputs [ src, dest, prefix ] ") print("> cvt - inputs [src, dest, factors ] ... cvt factors input format is json") print("> cvt factors format \'{\"DATA\":[{\"KEY\":\"CVT_MATCH_KEY\", \"VAL\":\"CVT_VAL\", \"OPT\":\"Insert Position\"}]}\' ") print("> cvt factors option ") @@ -253,7 +261,7 @@ def quickMain(): if len(sys.argv) >= 5 : factors = sys.argv[4] convert(src, dest, factors) - elif sys.argv[1] == "cp" : + elif sys.argv[1] == "diffcp" : prefix = False if len(sys.argv) >= 5 : prefix = sys.argv[4] diff --git a/setup.py b/setup.py index 0df32dd..681d799 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup(name='pykun', - version='0.1.2', + version='0.1.3', url='https://github.com/kunrunic/pykun',