Issue
i have 126 folders in the same directory with names like this "5d843c63-2043-499b-abd6-6ea0bbde5f58"
each folder contain 1 #pdf file i want to move each file to one
i have used the command and managed to locate all the pdfs in the separated folders
locate ~/Desktop/wps\ /*pdf
then i used the " | " to move them at once but i couldn't i use the commnad
locate ~/Desktop/wps\ /*pdf | mv ~/Desktop/pdffff/
STOUD be like mv: missing destination file operand after '/home/yousef/Desktop/pdffff/'
using ubuntu
Solution
I don't know the locate command, but if it returns a list of paths of the files you want, do
mv `locate ~/Desktop/wps\ /*pdf` /path_to/new_folder_to_store_pdfs
The backticks ` `
will execute the locate
command first, then the output of locate
will be substituted into the outer mv
command.
I did it just now with find and it worked.
mv `find -name *pdf` new_folder
Answered By - wxz