FAQ: Manipulation - Wildcards

This community-built FAQ covers the “Wildcards” exercise from the lesson “Manipulation”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn the Command Line

FAQs on the exercise Wildcards

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!
You can also find further discussion and get answers to your questions over in #get-help.

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head to #get-help and #community:tips-and-resources. If you are wanting feedback or inspiration for a project, check out #project.

Looking for motivation to keep learning? Join our wider discussions in #community

Learn more about how to use this guide.

Found a bug? Report it online, or post in #community:Codecademy-Bug-Reporting

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

How Can I reset the exercise?

type clear, then enter
then check where you are with pwd, then ls. If you want to go back type cd …/

Hi ! This is not an actual answer to the previous posts as I can’t see them, but I guess I’m stuck on the same Wildcard exercise : https://www.codecademy.com/courses/learn-the-command-line/lessons/command-line-manipulation/exercises/wildcards-command-line-manipulation

I don’t understand why after doing

```cp m*.txt scifi/``

in the action/ directory, and then ls I end up with these files :

batman.txt scifi superhero superman.txt wonderwoman.txt

on top of the files starting with m.

Before writing ls, I had written ls -a, maybe that’s why, but I cleared the shell, rewrote the whole exercise but Bash seems to be unforgetting.
So is this the mistake I made ? Should I come back tomorrow on the exercise, see if Bash has finally forgotten or is there something else to do ?
Thank you in advance for your answer !

Found it !
We have to write ls scifi/ although we already are in scifi/. ls is not enough.

Can somebody tell me where I got it wrong - I don’t know where to put the * in!

We want to copy all the files in the current directory into satire. Right now, you’re trying to copy only files with certain characteristics. Take a look at the first example provided in this lesson; it demonstrates how to copy all the files from one directory into another.

1 Like

I am being flagged even though I successfully copied both shrek.txt and the-office.txt into the Satire directory.

Screen shot

I am unable to move forward with the lesson. Is this a bug?

I’m having the same issue, pretty certain i’ve completed what the step asked but cannot move on.

Disregard, was using the wrong syntax

This does not reset the exercise, this just clears the console. To reset, click the x at the top of the console and then click the + to open a new console

The problem is that earlier in the lesson, we are taught that there are “files” and “directories” and that they are separate objects which is true. In these instructions we are told to copy all the “files” in the current directory when in fact, in order to get passed this step one has to copy all the files and folders despite the instructions not mentioning this.
Once you copy all the files and folders to the destination, the step is updated to completed.
Someone should fix the instructions to included “Directories” or “Folders”.

I was replying to someone else in this thread with a different issue.

However, with your problem, the command you need to use, cp * satire/, does not copy the directories, it only copies files. You need to copy all the files in the current directory, regardless of their file extension. Using *.txt, you will only copy text files (although there are only text files in the current directory, the lesson is trying to teach you that you can move all files quickly and with few keystrokes by just using *).

satire shrek.txt slapstick the-office.txt
$ cp * satire
cp: -r not specified; omitting directory ‘satire’
cp: -r not specified; omitting directory ‘slapstick’

Even I pass the no3, but should I ignore the cp: -r… statement? What’s that ?

1 Like

I have the same issue. Can somebody explain why this error appears?

1 Like

It’s actually not an error, you were correct in using cp rather than cp -r.

Here, the -r is a modifer that could be used to copy items recursively. If you used -r, not only would the_office.txt and shrek.txt be copied, the contents of the satire and slapstick directories (and any subdirectories of the two directories, and any subdirectories of those subdirectories, and so on) would be copied as well.


Thank you for explaining this. For me, it was unclear why the console outputted these “comments” - “cp: -r not specified; omitting directory ‘satire’”.

1 Like

I have a question related to how wildcards are able to know which files to copy from

Do wildcards only copy from the current and active directory?

Based on this file tree structure: https://static-assets.codecademy.com/Courses/learn-the-command-line/LCL-fileTrees-02.png

If my objective is to copy and paste all of the files in historical into satire, would the following steps be what I’ll have to do?

$ cd drama/historical/
$ cp * comedy/satire/

Thank you in advance!

Without any command modifiers, it copies only the files in the current directory.

cp * some_directory

With the recursive command modifier, it copies the files in the current directory, as well as all of the subdirectories and files in those subdirectories of the current directory, and any subdirectories and files in the subdirectories of those subdirectories, etc.

cp -r * some_directory
cp -R * some_directory

You can find the modifiers for the cp command here.

This is also a good read:


Does anyone know what is wrong with my code? I have reset and create a new bash page but when I copied what joshuajackson4732703 did, it is still not right. Thank you so much!!