擅长:python、mysql、java
<p>在目录中递归运行,移动文件并启动目录的<code>move</code>:</p>
<pre><code>import shutil
import os
def move(destination, depth=None):
if not depth:
depth = []
for file_or_dir in os.listdir(os.path.join([destination] + depth, os.sep)):
if os.path.isfile(file_or_dir):
shutil.move(file_or_dir, destination)
else:
move(destination, os.path.join(depth + [file_or_dir], os.sep))
</code></pre>