Rename and move file with Python

后端 未结 4 1060
囚心锁ツ
囚心锁ツ 2021-02-07 03:05

I have python script that compares existing file names in a folder to a reference table and then determines if it needs to be renamed or not.

As it loops through each fi

4条回答
  •  北恋
    北恋 (楼主)
    2021-02-07 03:40

    Create a Python file in your desired directory and write something like that :

    import os
    
    for filename in os.listdir("."):
        if(filename ...):
            newFilename = ...
            os.rename(filename, newFilename)
    

提交回复
热议问题