Anything better than shutil?
chris at simplistix.co.uk
Sat Nov 14 16:54:51 CET 2009
Roy Smith wrote:
> The idea interface I see would be one like:
> shutil.copy([source_dir, '*.conf'], conf_dir)
> the idea is that if the first argument is a list (or maybe any
> iterable other than a string?), it would automatically get run through
> os.path.join(). And, the result would always get passed through glob
> (), just like a normal shell would. Does anything like this exist?
Why don't you wrap up your earlier code:
> configs = glob.glob(os.path.join(source_dir, '*.conf'))
> for conf_file in configs:
> shutil.copy(conf_file, conf_dir)
...in a module with the exact interface you're after?
Simplistix - Content Management, Batch Processing & Python Consulting
More information about the Python-list