MCPcopy Create free account
hub / github.com/ActiveState/code / movefiles

Function movefiles

recipes/Python/577411_Recoursive_File_Moving/recipe-577411.py:36–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34 numofiles += 1
35
36def movefiles():
37 print '.',##just lets the user know it hasn't crashed for large batches
38 for x in os.listdir(os.getcwd()):
39 if os.path.isdir(x):
40 os.chdir(x)
41 movefiles()
42 os.chdir('..')
43 if os.path.isfile(x) and os.getcwd() != rootdir:
44 shutil.move(x, '..')
45
46def deletedirs():
47 global numofdirs

Callers 1

recipe-577411.pyFile · 0.85

Calls 6

getcwdMethod · 0.80
isdirMethod · 0.80
chdirMethod · 0.80
isfileMethod · 0.80
listdirMethod · 0.45
moveMethod · 0.45

Tested by

no test coverage detected