Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need help with passing a wild card array to cp, I know it can be done but cant figure it out,

ive got 3 files all start with the word somefile but have 3 different extensions

  • somefile.conf
  • somefile.dat
  • somefile.py

there in a folder with a bunch of other files and I just want to copy them to a different location.

I remember is being something like

cp somefile.[py conf dat] /somewhere

but this isn't working

Ive searched the net and can't find it with the keywords i'm using.

share|improve this question
up vote 2 down vote accepted

Depending on the shell, you could use brace expansion

cp somefile.{py,conf,dat} /somewhere
share|improve this answer
    
That done the trick thankyou very much, will accept when su lets me – squarebear Sep 12 '11 at 9:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .