shutil Questions
4
Solved
Python's shutil.copytree is not very flexible; what is the simplest way to add support for ignoring permissions while copying in copytree (without having to re-write its implementation)?
Otherwise...
1
I am making a script that compresses folders via shutil.make_archive, but the folders can be large, so it will take a while. Is there some sort of way I can show the percentage complete? So far I h...
Wilburnwilburt asked 12/7, 2020 at 6:59
4
Solved
Overwrite directory with shutil.rmtree and os.mkdir sometimes gives 'Access is denied' error
My code:
if os.path.exists(myDir):
shutil.rmtree(myDir)
os.mkdir(myDir)
Problem: It always work if myDir does not exist. If myDir exists, sometimes it throws error, sometimes it works.
Error l...
Corvine asked 13/4, 2018 at 4:47
3
Solved
I have App dir inside Release dir
$ cd Release
$ tree
.
`-- App
|-- App.exe
..........
and I am trying to create App-1.0.zip in the Release dir containg App with all its content. That is after...
Lander asked 24/3, 2018 at 17:41
4
Solved
I want to use shutil.rmtree in Python to remove a directory. The directory in question contains a .git control directory, which git marks as read-only and hidden.
The read-only flag causes rmtree ...
5
Solved
I am using the shutil.disk_usage() function to find the current disk usage of a particular path (amount available, used, etc.). As far as I can find, this is a wrapper around os.statvfs() calls. I'...
8
Solved
I'm trying to zip a directory called test_dicoms to a zip file named test_dicoms.zip using the following code:
shutil.make_archive('/home/code/test_dicoms', 'zip', '/home/code/test_dicoms')
The pr...
5
Solved
Is there a way I can filter a directory by using the absolute path to it?
shutil.copytree(directory,
target_dir,
ignore = shutil.ignore_patterns("/Full/Path/To/aDir/Common"))
This doesn't see...
3
I have a function:
def path_clone( source_dir_prompt, destination_dir_prompt) :
try:
shutil.copytree(source_dir_prompt, destination_dir_prompt)
print("Potentially copied?")
except OSError as e...
3
Solved
I am using the shutil python module to copy files and directories on a linux redhat machine.
I wrote the following method, which takes in 2 params: src (the path of the file or dir that is being c...
2
Solved
3
Can anyone tell me how to copy or move a batch of files to another directory or other directories. The name of the files are in a list that are in a text file. I'm working on a Windows system. The ...
3
Solved
I'm trying to move file to recycle bin using shutil library. Following is relevant code lines, but I get kinda strange error. Both files are local, and I can access both locations on my PC. Why thi...
2
I'm working with the shutil.copy method in python.
I found the definition listed below:
def copyFile(src, dest):
try:
shutil.copy(src, dest)
# eg. src and dest are the same file
except shutil.E...
3
I can't figure out how to use shutil.make_archive to zip a folder into a zip-file and then put that saved_20170721.zip file into the folder named past_data
I have the code:
from shutil import mak...
1
Code and error (Reduced, if you'd like to see the full code, refer to the last section):
import shutil
import os
filteredCleaned =
'/Volumes/Extreme_SSD/Raymond_Lab/Day_4_Rotarod_Videos_Rotated_...
Bainter asked 4/11, 2020 at 20:9
15
Solved
Run the following code from a directory that contains a directory named bar (containing one or more files) and a directory named baz (also containing one or more files). Make sure there is not a di...
6
Solved
I'm trying use shutil.copytree:
shutil.copytree(SOURCE_DIR, TARGET_DIR, ignore=None)
This copy also files in folder. I need copy only folders without ANY files. How to do it?
2
Solved
A python script I'm using is at one point moving a list of files from one directory to the other. I have implemented it with shutil.move:
for a_file in list_of_filenames:
src = os.path.join(src_d...
2
I am trying to zip multiple folders using shutil.make_archive using threads in python. I see that the smaller folder zips completely and at the same time the other thread also stops zipping.
So, is...
2
Solved
I have a flask app where using one Flask route the server creates a csv file and saves it to the server. Using a generated button on the client page, another Flask route is triggered to get the mos...
2
I have the following code because sometimes these files will be the same and sometimes they won't.
import shutil
try:
shutil.copy('filea','fileb')
shutil.copy('filec','filed')
except shutil.Same...
5
Solved
I have a program which copies large numbers of files from one location to another - I'm talking 100,000+ files (I'm copying 314g in image sequences at this moment). They're both on huge, VERY fast ...
Chongchoo asked 2/6, 2017 at 3:31
1
Trying to use shutil.which() to determine if git is installed. From the docs, I see which() on Windows should use PATHEXT to know which file extensions to append when searching. However the followi...
3
I wrote a script to upload my models and training examples to Google Drive after every iteration in case of crashes or anything that stops the notebook from running, which looks something like this...
Nous asked 22/7, 2019 at 17:59
1 Next >
© 2022 - 2024 — McMap. All rights reserved.