Linked Questions

29 votes
1 answer
38k views

Whenever I try to use them to remove dirs with things in them I get this error message import os os.chdir('/Users/mustafa/Desktop') os.makedirs('new-file/sub-file') os.removedirs('new-file') "/...
Mustafa 's user avatar
5 votes
1 answer
7k views

I need to process some file generated from db objects and after required process need to delete that directory with files.I have decided to use python templefile package. I have give it a try but ...
Abdul Rehman's user avatar
  • 5,704
-4 votes
1 answer
2k views

I want do delete a file, for ex. 'myfile.txt' that is stored under a hidden folder. Is it possible to do this in python? thank you
Rares Pasca's user avatar
3 votes
1 answer
354 views

Here's my code : import glob import pandas import os os.chdir("/filepath") extension = 'xlsx' all_filenames = [i for i in glob.glob('*.{}'.format(extension))] combined = pd.concat([pd....
LaurieFalcon's user avatar
1 vote
0 answers
109 views

As far I can tell, there are separate APIs to remove folders and files in Python (os.remove and os.rmdir or shutil.rmtree). Isn't there one function library that does it all, no question asked, or do ...
Lolo's user avatar
  • 4,219
0 votes
0 answers
62 views

In my project I have used the python-git module to clone the repo. but for the cleanup I have to remove the directory as well. I am using the following method for cleanup but it did not work. def ...
Nitin Namdev's user avatar
2 votes
0 answers
60 views

Hey i wanted to know how to remove a folder or a file with the module os in python. def remove_folder(): remoce_folder = str(input("What is the directory path of the folder: ")) How ...
Nathor69's user avatar
0 votes
0 answers
36 views

Question: I have a simple Python script that prompts the user with a warning message. If the user responds with “yes,” I want to create a bash script that removes the .config/nvim directory. Here’s my ...
user avatar
1142 votes
24 answers
1.1m views

I am getting an "access is denied" error when I attempt to delete a folder that is not empty. Newer versions of Python may also report a "directory not empty" error. I used the ...
Amara's user avatar
  • 14.4k
96 votes
2 answers
179k views

NetworkX is powerful but I was trying to plot a graph which shows node labels by default and I was surprised how tedious this seemingly simple task could be for someone new to Networkx. There is an ...
Pranjal Mittal's user avatar
6 votes
3 answers
32k views

I have seen some posts to delete all the files (not folders) in a specific folder, but I simply don't understand them. I need to use a UNC path and delete all the files that are older than 7 days. ...
Edward Shaw's user avatar
11 votes
5 answers
27k views

I wrote a python script to detect broken images and count them, The problem in my script is it detects all the images and does not detect broken images. How to fix this. I refered : How to check if ...
Ajinkya's user avatar
  • 1,885
6 votes
3 answers
5k views

I want to create a graph and draw it, so far so good, but the problem is that i want to draw more information on each node. I saw i can save attributes to nodes\edges, but how do i draw the attributes?...
rafi wiener's user avatar
1 vote
3 answers
5k views

i got this list commands = ['cd var','cd www','cd html','sudo rm -r folder'] I'm trying to execute one by one all the elements inside as a bash script, with no success. Do i need a for loop here? ...
Mauro Encinas's user avatar
-3 votes
2 answers
9k views

I want to delete a specific line in a text file in python. for example, say in my text file I have: Ben Walsh - 768 James Cook - 659 Jamie Walsh - 4359 Owen Perkins - 699 Dylan Thomas - 1574 ...
Ben Walsh's user avatar

15 30 50 per page