Finding and moving images without extensions between two directories [duplicate]
Clash 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?
command
New contributor
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.
add a comment |Â
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?
command
New contributor
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
add a comment |Â
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?
command
New contributor
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
command
New contributor
New contributor
edited Oct 1 at 17:33
Goro
7,02252965
7,02252965
New contributor
asked Oct 1 at 16:55
marco
1124
1124
New contributor
New contributor
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
add a comment |Â
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
add a comment |Â
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.
add a comment |Â
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.
add a comment |Â
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.
add a comment |Â
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.
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.
edited Oct 1 at 17:31
answered Oct 1 at 17:24
Goro
7,02252965
7,02252965
add a comment |Â
add a comment |Â
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