1
$\begingroup$

I have many files named like this "GSM697492_500_D1.CEL", and a another file which contain the first part of the file name like this"GSM697492". I want to copy the some of the CEL files from one directory to another.How can I do this? I have tried with the following code

FileNames["E:\\work\\META分析\\source\\GSE28160_RAW1\\" ~~ cases[[1]] ~~ "*.CEL"]

where "case" is a list contain all the file names I want. the output

{"E:\\work\\META分析\\source\\GSE28160_RAW1\\GSM697492_500_D1.CEL"}

and then

CopyFile["E:\\work\\META分析\\source\\GSE28160_RAW1\\" ~~ cases[[1]] ~~"*.CEL", "E:\\work\\1.CEL"]

but the output is $Failed. Could someone help me with this question? I will appreciate it.

$\endgroup$
1
  • $\begingroup$ Thank you very much for your valuable comment, george2079 said "CopyFile on is own does not do filesystem globbing and so the way you have it its looking for a file that literally has a "*" in its name." and you both right. $\endgroup$
    – Zihu Guo
    Commented Oct 7, 2014 at 15:09

1 Answer 1

1
$\begingroup$

try this:

 CopyFile[First@FileNames[
       "E:\\work\\META分析\\source\\GSE28160_RAW1\\" ~~ cases[[1]]
              ~~"*.CEL"], "E:\\work\\1.CEL"]

CopyFile on is own does not do filesystem globbing and so the way you have it its looking for a file that literally has a "*" in its name.

$\endgroup$
1
  • $\begingroup$ Thank you very much, you are right, you help me solved this problem $\endgroup$
    – Zihu Guo
    Commented Oct 7, 2014 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.