From e8db8008310e96245e9399e455d1b1d24feff0e1 Mon Sep 17 00:00:00 2001 From: secret_dude Date: Wed, 2 Jun 2021 01:33:24 +0200 Subject: [PATCH] minor changes --- changeFilenames.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 changeFilenames.py diff --git a/changeFilenames.py b/changeFilenames.py new file mode 100644 index 0000000..fae74d6 --- /dev/null +++ b/changeFilenames.py @@ -0,0 +1,23 @@ +# Pythono3 code to rename multiple +# files in a directory or folder + +# importing os module +import os + + +path = 'neural_network\\images\\potatoes\\' +def main(): + for count, filename in enumerate(os.listdir(path)): + dst = 'potato' + str(count) + ".jpg" + src = path + filename + dst = path + dst + + # rename() function will + # rename all the files + os.rename(src, dst) + + +# Driver Code +if __name__ == '__main__': + # Calling main() function + main() \ No newline at end of file