a challenging project idea - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: General (https://python-forum.io/forum-1.html) +--- Forum: News and Discussions (https://python-forum.io/forum-31.html) +--- Thread: a challenging project idea (/thread-17203.html) |
a challenging project idea - Skaperen - Apr-02-2019 this is not a joke. it is currently in perl. the "rename" command that i use in linux, although making it work in windows is ok. RE: a challenging project idea - nilamo - Apr-02-2019 https://docs.python.org/3/library/pathlib.html#pathlib.Path.rename import pathlib def rename(fname, to): pathlib.Path(fname).rename(to) if __name__ == "__main__": import sys if len(sys.argv) >= 3: fname, to = sys.argv[1:3] rename(fname, to) else: print("rename.py: [from] [to]") RE: a challenging project idea - Skaperen - Apr-03-2019 it does not seem to work as a rename command:
RE: a challenging project idea - nilamo - Apr-03-2019 https://linux.die.net/man/1/rename So it's more complicated than just an alias for mv . I didn't realize it was basically sed but for file names.
RE: a challenging project idea - Skaperen - Apr-04-2019 that's what makes it challenging. the implementation in Ubuntu is in Perl. i figured if Python had PCRE support, then it might be doable. |