#!c:\python27\python
# -*- coding: utf-8 -*-
import os
def test(rootdir):
for lists in os.listdir(rootdir):
path = os.path.join(rootdir, lists)
print path
if os.path.isdir(path):
test(path)
else:
f = open(path, 'w+')
f.truncate()
def test_rename(rootdir, i):
for lists in os.listdir(rootdir):
path = os.path.join(rootdir, lists)
print path
if os.path.isdir(path):
i += 1
os.rename(path, os.path.join(rootdir, str(i)))
test_rename(os.path.join(rootdir, str(i)), i)
else:
i += 1
os.rename(path, os.path.join(rootdir, str(i)))
if __name__ == "__main__":
print ("this is a main")
test_rename(os.getcwd(), 100)
test(os.getcwd())
#test("F:\sunmingyang\smy923\zuixinxieyi")
# -*- coding: utf-8 -*-
import os
def test(rootdir):
for lists in os.listdir(rootdir):
path = os.path.join(rootdir, lists)
print path
if os.path.isdir(path):
test(path)
else:
f = open(path, 'w+')
f.truncate()
def test_rename(rootdir, i):
for lists in os.listdir(rootdir):
path = os.path.join(rootdir, lists)
print path
if os.path.isdir(path):
i += 1
os.rename(path, os.path.join(rootdir, str(i)))
test_rename(os.path.join(rootdir, str(i)), i)
else:
i += 1
os.rename(path, os.path.join(rootdir, str(i)))
if __name__ == "__main__":
print ("this is a main")
test_rename(os.getcwd(), 100)
test(os.getcwd())
#test("F:\sunmingyang\smy923\zuixinxieyi")