Jeremy Fisher
Jeremy Fisher

Reputation: 2782

Copying multiple files of different file types UNIX

I have some files that are .py and others that are ".txt". Instead of

cp *.py myDir/
cp *.txt myDir/

is there a way to perform this in one line on the command line?

Thanks

Upvotes: 1

Views: 113

Answers (1)

Alexander Yancharuk
Alexander Yancharuk

Reputation: 14531

Try this:

cp *.{py,txt} myDir/

More info about *nix wildcards you can find here.

Upvotes: 1

Related Questions