Finding and moving images without extensions between two directories [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite













This question already has an answer here:



  • How to list only JPEG files from root below using the command line?

    3 answers



I have an old disorganized repository of files in a directory. I would like to move solely the images files to a new directory for archival purposes. The problem is that in this directory I have a mixture of multiple different types of files, including videos and movies. In addition, I have multiple types of images. Many of the images have no extension and I would like to move only the "jpeg" images to the new repository, so I can organize the jpeg files in a folder for its type. How can I do this?










share|improve this question









New contributor




marco is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











marked as duplicate by RalfFriedl, Goro, don_crissti, Community♦ Oct 1 at 17:50


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1




    What is a "repository" in this case?
    – Philip Kendall
    Oct 1 at 16:57










  • hi, it is a folder on my computer
    – marco
    Oct 1 at 16:59














up vote
4
down vote

favorite













This question already has an answer here:



  • How to list only JPEG files from root below using the command line?

    3 answers



I have an old disorganized repository of files in a directory. I would like to move solely the images files to a new directory for archival purposes. The problem is that in this directory I have a mixture of multiple different types of files, including videos and movies. In addition, I have multiple types of images. Many of the images have no extension and I would like to move only the "jpeg" images to the new repository, so I can organize the jpeg files in a folder for its type. How can I do this?










share|improve this question









New contributor




marco is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











marked as duplicate by RalfFriedl, Goro, don_crissti, Community♦ Oct 1 at 17:50


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1




    What is a "repository" in this case?
    – Philip Kendall
    Oct 1 at 16:57










  • hi, it is a folder on my computer
    – marco
    Oct 1 at 16:59












up vote
4
down vote

favorite









up vote
4
down vote

favorite












This question already has an answer here:



  • How to list only JPEG files from root below using the command line?

    3 answers



I have an old disorganized repository of files in a directory. I would like to move solely the images files to a new directory for archival purposes. The problem is that in this directory I have a mixture of multiple different types of files, including videos and movies. In addition, I have multiple types of images. Many of the images have no extension and I would like to move only the "jpeg" images to the new repository, so I can organize the jpeg files in a folder for its type. How can I do this?










share|improve this question









New contributor




marco is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












This question already has an answer here:



  • How to list only JPEG files from root below using the command line?

    3 answers



I have an old disorganized repository of files in a directory. I would like to move solely the images files to a new directory for archival purposes. The problem is that in this directory I have a mixture of multiple different types of files, including videos and movies. In addition, I have multiple types of images. Many of the images have no extension and I would like to move only the "jpeg" images to the new repository, so I can organize the jpeg files in a folder for its type. How can I do this?





This question already has an answer here:



  • How to list only JPEG files from root below using the command line?

    3 answers







command






share|improve this question









New contributor




marco is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




marco is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Oct 1 at 17:33









Goro

7,02252965




7,02252965






New contributor




marco is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Oct 1 at 16:55









marco

1124




1124




New contributor




marco is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





marco is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






marco is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




marked as duplicate by RalfFriedl, Goro, don_crissti, Community♦ Oct 1 at 17:50


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by RalfFriedl, Goro, don_crissti, Community♦ Oct 1 at 17:50


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









  • 1




    What is a "repository" in this case?
    – Philip Kendall
    Oct 1 at 16:57










  • hi, it is a folder on my computer
    – marco
    Oct 1 at 16:59












  • 1




    What is a "repository" in this case?
    – Philip Kendall
    Oct 1 at 16:57










  • hi, it is a folder on my computer
    – marco
    Oct 1 at 16:59







1




1




What is a "repository" in this case?
– Philip Kendall
Oct 1 at 16:57




What is a "repository" in this case?
– Philip Kendall
Oct 1 at 16:57












hi, it is a folder on my computer
– marco
Oct 1 at 16:59




hi, it is a folder on my computer
– marco
Oct 1 at 16:59










1 Answer
1






active

oldest

votes

















up vote
5
down vote



accepted










You can use the command find as follows:



find . -type f -exec sh -c 'file --mime-type "$0" | grep -q image/jpeg$ && printf "$0n"' ; -exec mv -t 'path_to_new_folder' +


This command will find jpeg files without extensions then move these files to a new folder.






share|improve this answer





























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    5
    down vote



    accepted










    You can use the command find as follows:



    find . -type f -exec sh -c 'file --mime-type "$0" | grep -q image/jpeg$ && printf "$0n"' ; -exec mv -t 'path_to_new_folder' +


    This command will find jpeg files without extensions then move these files to a new folder.






    share|improve this answer


























      up vote
      5
      down vote



      accepted










      You can use the command find as follows:



      find . -type f -exec sh -c 'file --mime-type "$0" | grep -q image/jpeg$ && printf "$0n"' ; -exec mv -t 'path_to_new_folder' +


      This command will find jpeg files without extensions then move these files to a new folder.






      share|improve this answer
























        up vote
        5
        down vote



        accepted







        up vote
        5
        down vote



        accepted






        You can use the command find as follows:



        find . -type f -exec sh -c 'file --mime-type "$0" | grep -q image/jpeg$ && printf "$0n"' ; -exec mv -t 'path_to_new_folder' +


        This command will find jpeg files without extensions then move these files to a new folder.






        share|improve this answer














        You can use the command find as follows:



        find . -type f -exec sh -c 'file --mime-type "$0" | grep -q image/jpeg$ && printf "$0n"' ; -exec mv -t 'path_to_new_folder' +


        This command will find jpeg files without extensions then move these files to a new folder.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Oct 1 at 17:31

























        answered Oct 1 at 17:24









        Goro

        7,02252965




        7,02252965












            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay