1

I need to move all my pdf files from one folder to another folder. How can I do this in terminal?

Zanna
  • 70,465
Moji
  • 11

2 Answers2

3

To move all pdf's from a single folder to another folder:

mv *.pdf /some/other/folder

To move all pdf's from multiple folders to another folder

find /home/user -name '*.pdf' -exec mv -t /some/other/folder {} +

More information on find and mv can be found from man:

man find
man mv
1

If you must use mv, use it with find and xargs. Read man mv. Read man find. Read man xargs.

find . -type f -iname '*.pdf' -print0 | xargs -0 echo mv --target-directory=/somehwere/else/ 

Remove the echo when you're happy with the results.

waltinator
  • 36,399