Vbs Delete All Files In A Folder And Subfolders On Iphone

Vbs Delete All Files In A Folder And Subfolders On Iphone Rating: 3,7/5 3315 reviews

If the directory you want to delete does contain other files or, worse, subdirectories it seems that you are forced to use a recursive routine that does the job. You add a reference to the ' Microsoft Scripting Runtime type library ' delete the C: TEMP directory and all its sub-directories Dim fso As New Scripting. Vbs Delete All Files In A Folder And Subfolders On Iphone. August 16, 2017.

Active2 years, 8 months ago

I try to delete 300 pdf files. All the pdf files as different names, and they all spread in one big folder that divided to a lot of sub folders and sub sub folders. How can I do it with python (I work with python 2.7.8)?

Brian Tompsett - 汤莱恩
4,46714 gold badges40 silver badges108 bronze badges
newGISnewGIS
2701 gold badge7 silver badges20 bronze badges

4 Answers

Using shutil.rmtree, you can delete directories recursively.

If the directory contians other files that is not pdf file, use following instead (which use os.walk to traverse the directories recursively, and os.remove/os.unlink to remove the pdf file).

falsetrufalsetru
263k38 gold badges480 silver badges472 bronze badges

If all you want is delete just the pdf file you can use the os.walk function and fnmatch.fnmatch function.

styvaneVbs Delete All Files In A Folder And Subfolders On Iphonestyvane
38.8k14 gold badges93 silver badges111 bronze badges

os.chdir to change directory. just do some tweak to locate to other directory

Dyrandz FamadorDyrandz Famador

Vbs Delete All Files In A Folder And Subfolders On Iphone 6

3,8825 gold badges16 silver badges34 bronze badges

Assuming you want to delete the files while maintainig the subfolders tree, you could use a recursive algorithm:

fmonegagliafmonegaglia
1,7521 gold badge17 silver badges27 bronze badges

Not the answer you're looking for? Browse other questions tagged pythonpython-2.7pdfdelete-file or ask your own question.

Comments are closed.