[Durian-svn] [2713] A little script hack to rename all files in a folder.
dolf
institute at blender.org
Fri Apr 30 16:39:04 CEST 2010
Revision: 2713
https://blenderinstitute.dyndns.org/durian-svn/?do=log&project=durian&path=/&rev=2713
Author: dolf
Date: 2010-04-30 16:39:04 +0200 (Fri, 30 Apr 2010)
Log Message:
-----------
A little script hack to rename all files in a folder.
Added Paths:
-----------
pro/scripts/utilities/renameFiles.py
Added: pro/scripts/utilities/renameFiles.py
===================================================================
--- pro/scripts/utilities/renameFiles.py (rev 0)
+++ pro/scripts/utilities/renameFiles.py 2010-04-30 14:39:04 UTC (rev 2713)
@@ -0,0 +1,54 @@
+'''
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Contributor(s): Dolf
+ *
+ * ***** END GPL LICENSE BLOCK *****
+'''
+
+# THIS SCRIPT RENAMES ALL THE FILES IN A FOLDER... VERY CAREFULL!!!
+# Put the script in a folder and run (used to rename properly rendered local files to the renderfarm's style filename)
+
+# Make sure you set the start number and newName correctly!!
+
+import os
+
+# This is the start number... SET THIS VARIABLE!
+nr = 671
+
+files = []
+
+for fname in os.listdir(os.getcwd()):
+ if fname != 'renameFiles.py':
+ files.append(fname)
+
+files.sort()
+
+print(files)
+
+for f in files:
+
+ nr += 1
+
+ newName = '02.h_comp_000'+str(nr)+'.exr'
+
+ print(newName)
+
+ os.rename(f, newName)
+
+
\ No newline at end of file
More information about the Durian-svn
mailing list