This program moves files such as "*.png" and "*.gif" in a folder to the other folder.
I'm publishing a "code snippet" tag to show what I've made in batches and small code that I think I can use.
import os import shutil import glob def exmove( srcdir, destdir, srcfiles ): for fpattern in srcfiles: globsearch = os.path.join( srcdir, fpattern ) for fpath in glob.glob(globsearch): shutil.move(fpath, destdir) # RUN exmove( "./from", "./to", ["*.jpg", "*.gif"] )
In this case, the code will move all files with jpg and gif extensions in the "from" directory under the current directory to the "to" directory under the current directory.
The usage here.
exmove( SOURCE DIR , DEST DIR , Array of FilePatterns )
When you call the exmove function, you can move the file from "./from" directory to "./to" directory.
Thank you for your message.
Sorry. The Error has occurred.We apologize for the inconvenience.Please try again in a few minutes or contact us via DM below.Twitter:@NodachiSoft_engName:
Send the following information to us. If you are happy with your submission, please click "Send". If you want to modify it, please click "Back".Name: