-6

Why does find match all the files when using it like this?

    find ~/ "*.pdf"

So, I accidentally messed up with my home directory and moved all the files into ~/Documents. Is there a way to undo that mv and bring back all the files as they were before.

If I can't do it, I would like to know to know how to restore my ~ directory with all the config files in place.

closed as unclear what you're asking by Anthon, Michael Homer, jimmij, jasonwryan, Ramesh Feb 17 '15 at 19:53

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    If it shows all the pdf files then its expected. – bluefoggy Feb 17 '15 at 6:54
  • It shows every single file with whatever extension. – letmutx Feb 17 '15 at 7:02
  • I think you need a space between '~/' and "*.pdf". – jamesqf Feb 17 '15 at 7:05
  • What do you expect from the first command? Maybe you mean find ~/ -name "*.pdf" or maybe you mean echo ~/"*.pdf". – michas Feb 17 '15 at 8:40
2

Your question contains two completely unrelated questions. Please keep it to one question per question.

Why does find match all the files when using it like this?

You have asked find to search in your home directory (~/) plus in a file called *.pdf (which probably does not exist) for... everything, since you didn't specify any search criteria.

Did you actually mean this?

find ~/ -name "*.pdf"

Is there a way to undo that mv and bring back all the files as they were before.

Check where the files can be found on your backups. Otherwise, no, there is no way.

  • Actually I added a -exec which would move all the stuff to my ~/Documents. But I forgot to add -name and ended up with moving everything in ~/ to ~/Documents. Thanks for the help. – letmutx Feb 17 '15 at 14:54

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