Python Forum
I am trying to copy files into a bunch of folders.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I am trying to copy files into a bunch of folders.
#2
from glob import glob

file_exts = ['*.doc', '*.ppt']

for ext in file_ext:
    print(glob(ext))
glob.glob(pattern) will return a list of matched file names
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
RE: I am trying to copy files into a bunch of folders. - by wavic - Apr-22-2017, 08:11 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Folders Splitter to Files Splitter Guybrush16bit 12 1,919 Mar-01-2025, 08:17 PM
Last Post: snippsat
  Copy and Paste Files - Command MicheliBarcello 2 1,028 Jun-25-2024, 05:04 AM
Last Post: rodiongork
  Using zipfile module - finding folders not files darter1010 2 2,605 Apr-06-2024, 07:22 AM
Last Post: Pedroski55
  Why is the copy method name in python list copy and not `__copy__`? YouHoGeon 2 1,495 Apr-04-2024, 01:18 AM
Last Post: YouHoGeon
  Copy Paste excel files based on the first letters of the file name Viento 2 1,715 Feb-07-2024, 12:24 PM
Last Post: Viento
  Create new folders and copy files cocobolli 3 5,227 Mar-22-2023, 10:23 AM
Last Post: Gribouillis
  Copy only hidden files and folders with rsync Cannondale 2 2,483 Mar-04-2023, 02:48 PM
Last Post: Cannondale
  a bunch of modules to import Skaperen 2 1,709 Nov-07-2022, 07:33 PM
Last Post: Gribouillis
  Compare filename with folder name and copy matching files into a particular folder shantanu97 2 6,674 Dec-18-2021, 09:32 PM
Last Post: Larz60+
  Moving files to Folders giddyhead 13 13,080 Mar-07-2021, 02:50 AM
Last Post: giddyhead

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020