ro  fr  en  es  pt  ar  zh  hi  de  ru
ART 2.0 ART 3.0 ART 4.0 ART 5.0 ART 6.0 Pinterest

पायथन कॉपी या किसी फ़ोल्डर से किसी अन्य फ़ोल्डर में फ़ाइलों को ले जाता है

On December 01, 2021, in Leadership and Attitude, by Neculai Fantanaru

आप यहां पूरा कोड देख सकते हैं:Https: // passatin.com / और na ww2q

import shutil
import os


def move_files(source_director, destination_director):
    # select the files in the source directory
    fisiere = [fisier for fisier in os.listdir(source_director) if os.path.isfile(os.path.join(source_director, fisier))]
    print(fisiere)
    # each file in the source directory is moved to the destination directory
    for fisier in fisiere:
        shutil.move(source_director + '\\' + fisier, destination_director)

def copy_files(source_director, destination_director):
    # select the files in the source directory
    fisiere = [fisier for fisier in os.listdir(source_director) if os.path.isfile(os.path.join(source_director, fisier))]
    print(fisiere)
    # each file in the source directory is copied to the destination directory
    for fisier in fisiere:
        shutil.copy(source_director + '\\' + fisier, destination_director)

if __name__ == '__main__':
     # WARNING: paths to directories must be written with '\\' (double backslash)
     # here you set the DIN directory you want to move / copy the files

    source_director = 'c:\\Folder'

    destination_director = 'c:\\Folder\\Subfolder1\\Subfolder2'

    #CASE 1
    # move_files(source_director, destination_director)

    #CASE 2
    copy_files(source_director, destination_director)

That's all folks.

If you like my code, then make me a favor: translate your website into Romanian, "ro".

इसके अलावा, एक हैसंस्करण 1इस कोड यासंस्करण 2यासंस्करण 3यासंस्करण 4यासंस्करण 5

 


Latest articles accessed by readers:

  1. An Eye To See And A Mind To Understand
  2. Turn Towards Me With An Eye Full Of Your Own Gaze
  3. The Snapshot Of Magic In God's Universe
  4. Rhythm Of My Heart

Donate via Paypal

Alternate Text

RECURRENT DONATION

Donate monthly to support
the NeculaiFantanaru.com project

SINGLE DONATION

Donate the desired amount to support
the NeculaiFantanaru.com project

Donate by Bank Transfer

Account Ron: RO34INGB0000999900448439

Open account at ING Bank

Join The Neculai Fantanaru Community



* Note: If you want to read all my articles in real time, please check the romanian version !

decoration
About | Site Map | Partners | Feedback | Terms & Conditions | Privacy | RSS Feeds
© Neculai Fântânaru - All rights reserved