A small script written in python, delete non-empty directories and files, the code is as follows: #!/usr/bin/python #encoding=utf8 import os,sys if len(sys.argv) > 1: for filename In sys.argv[1:]: if os.path.isdir(filename): for root, dirs, files in os.walk(filename,topdown=False): for name in files: os.remove(os.path. Join(root, name)) print os.path.join(root,name) for name in dirs: os.rmdir(os.path.join(root, name)) print "delete %s" % (os.path .join(root,name)) os.rmdir(filename) else: os.remove(filename) else: print "Using method: rm.py filename1 filename2....." The principle is very simple with os.walk function Traversing the directory, topdown=False is this Given traverse from bottom to top, is not provided or if provided topdown = True, it is traversed from top to bottom.
Originally, I wanted to implement a function that traverses the directory. As a result, Python has already been provided, which is much more convenient
Today, the dealers we talked about in our program provided us with detailed steps
. The VPS in foreign countries uses Xen-Shell for control. It is quite convenient, and the tutorial
This article mainly describes the IIS not found provider The program may not be installed correctly
WebDA-based (Web-based Distributed Authoring and Versioning) A communication proto
Set the .htaccess file to implement the image anti-theft chain method
VPS novice Linux tutorial: SSH remote management /common commands /file upload download
Administrator Essentials Mainframe Backup Tool Application Guide
Analyze the advantages and disadvantages of network storage categories
Mail server software MDaemon uses skill
Check if the server is powered on
Let IIS support the detailed setting method of Flv
IIS failed to start "The system could not find the specified path"
How does Win7 set a beautiful set of pictures to the desktop background?
How to create the Win10 system taskbar toolbar?
How to use SkyDrive network disk under Win8.1 system
Share: Windows8 X86 Simplified Chinese Language Pack Installation Method
Microsoft pushes Windows 10 build 10586.71 to non-Insider users
How to disable the quick access bar of win10 system to display common folders?
What exactly does Win8 want to do? The version changes to see Microsoft's intentions
Microsoft official details. Net Native: Win10 universal application performance guarantee
How does Win10 improve the startup speed of League of Legends?