[Wapt] copie sous python

Hubert TOUVET htouvet at tranquil.it
Tue Feb 3 19:08:38 CET 2015


Le 03/02/2015 16:09, Fonteneau Simon a écrit :
> Bonjour
>
> Je cherche a faire un équivalent de cp ./font/* /home/policy/        
> sous python
>
> et comme dans un paquet wapt, incluant le chemin courant donc
donc sous linux ?
plusieurs solutions.
en voilà une :
------------
import glob,os,shutil

dest_dir = '/home/policy/'

# make sure destination exists
if not os.path.isdir(dest_dir):
     os.makedirs(dest_dir)

# copy files
for filename in glob.glob('./font/*'):
shutil.copyfile(filename,os.path.join(dest_dir,os.path.basename(filename)))

----------------
>
> Simon
>
>
> -- 
>
>
> _______________________________________________
> WAPT mailing list
> WAPT at lists.tranquil.it
> http://lists.tranquil.it/listinfo/wapt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tranquil.it/pipermail/wapt/attachments/20150203/05895c20/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 27405 bytes
Desc: not available
URL: <http://lists.tranquil.it/pipermail/wapt/attachments/20150203/05895c20/attachment-0001.jpe>


More information about the WAPT mailing list