shutil Questions

4

Solved

I have read the documentation for this function, however, I dont think I understand it properly. If anyone can tell me what I'm missing, or if I am correct, it would be a great help. Here is my und...
Ames asked 3/6, 2012 at 19:40

4

Solved

I've been trying to use the zipfile and shutil.make_archive modules to recursively create a zip file of a directory. Both modules work great--except empty directories do not get added to the archiv...
Proctology asked 1/8, 2012 at 2:33

2

Solved

Here is below code which will move and replace individual file: import shutil import os src = 'scrFolder' dst = './dstFolder/' filelist = [] files = os.listdir( src ) for filename in files: file...
Crystallography asked 4/8, 2015 at 15:36

1

Solved

Currently, I am working on a project in which am synchronizing two folders. My folders in the following example names ad Folder_1 as source and Folder_2 as destination I want to do the following th...
Christean asked 14/2, 2019 at 10:52

1

Solved

I would like to use the shutil.move() function to move some files which match a certain pattern to a newly created(inside python script)folder, but it seems that this function only works with exist...
Lyautey asked 14/8, 2019 at 21:22

2

Solved

As per the code below I am having issues with the zipping a directory using the python 3 shutil.make_archive function. The .testdir will be zipped but it is being zipped in /home/pi, instead of /ho...
Pinette asked 14/10, 2017 at 6:10

3

Solved

I have some python code using shutil.copyfile: import os import shutil src='C:\Documents and Settings\user\Desktop\FilesPy' des='C:\Documents and Settings\user\Desktop\\tryPy\Output' x=os.listdi...
Tours asked 30/6, 2012 at 22:10

7

Solved

I have a script which i'm using for copy purpose from one location to another location and the file beneath the directory structure are all .txt files. This script just evaluates the file size on ...
Inwrought asked 15/1, 2019 at 10:38

2

Solved

I'm fairly new to programming in general. I need to develop a program that can copy multiple directories at once and also take into account multiple file type exceptions. I came across the shutil m...
Blackmun asked 17/12, 2018 at 12:47

1

I've been trying to use make_archive from shutil library. Here is the code (with comprehensive comments): from shutil import make_archive make_archive( 'zipfile_name', 'zip', # archive f...
Trenton asked 25/10, 2017 at 22:29

2

Solved

I need to copy the files with include pattern using python script. Since shutil supports ignore_patterns to ignore the file. Is there any method to include the pattern to copy the files. Otherwise...
Entomb asked 29/8, 2018 at 7:18

3

Solved

I am trying to get my program to read a list of names from a file (say .txt), then search for those in a selected folder and copy and paste those files to another selected folder. My program runs w...
Suspicious asked 25/7, 2018 at 21:42

2

Solved

Consider this test import shutil, tempfile from os import path import unittest from pathlib import Path class TestExample(unittest.TestCase): def setUp(self): # Create a temporary directory s...
Confrere asked 1/6, 2018 at 19:6

4

Solved

I have a directory /a/b/c that has files and subdirectories. I need to copy the /a/b/c/* in the /x/y/z directory. What python methods can I use? I tried shutil.copytree("a/b/c", "/x/y/z"), b...
Honegger asked 22/2, 2013 at 22:19

1

I have a template excel file named as template.xlsx which has a number of sheets. I would like to copy data from a seperate .csv file into the first sheet of template.xlsx (named as data) and save ...
Shorthorn asked 2/4, 2018 at 11:58

0

I have an excel sheet (with the first row having numbers) named template.xlsx.It contains data in the sheet named ‘data’ as follows it also has a graph in the second sheet named graph like this ...
Enchantress asked 2/4, 2018 at 8:40

1

I'm trying to test my own version of antiweb, which can be found here. However, I am testing it with Pythons unittest module. Here is the code: import unittest from unittest.mock import patch from...
Lew asked 20/8, 2015 at 7:11

4

Solved

I am trying to use shutils.py , make_archive function. here: https://docs.python.org/2/library/shutil.html#archiving-operations but I can't understand the difference between root_dir and base_dir...
Tijuanatike asked 25/10, 2015 at 18:58

1

Solved

I am trying to complete a script for my work that cleans up their file organization system. The last part of my script needs to go inside all folders in a given directory, and move all files in eve...
Townsley asked 16/8, 2017 at 1:15

1

Solved

I need to copy all html files inside the same directory with another name and I need to navigate all directories inside the source directory. Here is my code so far, import os import shutil os.c...
Earthstar asked 7/7, 2017 at 15:46

1

Solved

I am trying to use Shutil to copy a pdf file using path objects from Pathlib, however when I run my code I get the error "str object is not callable" when converting my paths back to strings ...
Gibbeon asked 1/6, 2017 at 19:39

1

Solved

I want to copy some folders and files from a path to another path. for example, I want to copy the folder(called folder1) which has some other subfolders and some files inside itself to another fol...
Remonstrate asked 27/5, 2017 at 14:5

1

Solved

I have a directory that literally has 3000+ folders (all with subfolders). What I need to be able to do is to look through the directory for those files and move them to another folder. I've done ...
Dynode asked 20/4, 2017 at 9:25

0

I am using Python 3.5. I am using shutil.move(src, dest) to move a file between 2 different file systems. As I understand cross-device link error is raised by OS because it can't create hard link...
Advisement asked 17/4, 2017 at 21:58

1

I am trying to archive 2 files but not the full path leading up to the two files. Hopefully someone can point me in the right direction: My directory structure is as follows. I only have two files...
Conakry asked 12/1, 2017 at 23:20

© 2022 - 2024 — McMap. All rights reserved.