Copy only images in a specific directory ignoring the sub-directories in it











up vote
0
down vote

favorite












Excuse me for my Bad english.I want to copy only images(.png) present inside a specific directory(serenity) ignoring the sub-directories(datatables, images..etc,) in that, to another directory.



  find /home/user/Selenium_new/Staf/target/site/serenity/ -iname "*.png"


I used the above command to get all the images present inside the serenity directory, but it is also fetching images for sub-directories as well.The result of the command is:



/home/user/Selenium_new/Staf/target/site/serenity/images/success.png
/home/user/Selenium_new/Staf/target/site/serenity/images/menu_h.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-chrome.png
/home/user/Selenium_new/Staf/target/site/serenity/images/ico-q.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-appium.png
/home/user/Selenium_new/Staf/target/site/serenity/images/cross.png
/home/user/Selenium_new/Staf/target/site/serenity/images/small-middle.png
/home/user/Selenium_new/Staf/target/site/serenity/images/fail.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-iexplorer.png
/home/user/Selenium_new/Staf/target/site/serenity/images/screen.png
/home/user/Selenium_new/Staf/target/site/serenity/images/ignor.png
/home/user/Selenium_new/Staf/target/site/serenity/images/menu_s.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-remote.png
/home/user/Selenium_new/Staf/target/site/serenity/images/worker.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-phantomjs.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-safari.png
/home/user/Selenium_new/Staf/target/site/serenity/images/serenity-bdd-logo.png
/home/user/Selenium_new/Staf/target/site/serenity/images/video.png
/home/user/Selenium_new/Staf/target/site/serenity/images/small-middle-right.png
/home/user/Selenium_new/Staf/target/site/serenity/images/tick.png
/home/user/Selenium_new/Staf/target/site/serenity/images/plus.png
/home/user/Selenium_new/Staf/target/site/serenity/images/pending.png
/home/user/Selenium_new/Staf/target/site/serenity/images/menu_f.png
/home/user/Selenium_new/Staf/target/site/serenity/images/skip.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-provided.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-htmlunit.png
/home/user/Selenium_new/Staf/target/site/serenity/images/links_menu.png
/home/user/Selenium_new/Staf/target/site/serenity/images/minus.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-opera.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-firefox.png
/home/user/Selenium_new/Staf/target/site/serenity/9f5dedcc05678478e7511bb10f9fe15d_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/4a6c5da6264596f2e28453381a0958a2_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/d08552dd3fc9a718eda02eb432d35db1_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/2e756d0187d17ff7ede129c0cd26d5ed_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/3781a9f41cb06adbf2bcab99315e5016_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/jqtree/0.22/jqtree-circle.png
/home/user/Selenium_new/Staf/target/site/serenity/e4a22a00e04d0f54c7306e49a88e3a2c_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/0683540c982a0550834aaea79d71942a_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/76007c6a74590dce97d26dedf8344926_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/ab38399ff5f8b5222e8106c805b97e14_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/fb0cb5df5880626b23643f399bfc5b62_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_asc.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_desc.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/forward_enabled_hover.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_desc_disabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/forward_enabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/back_enabled_hover.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_asc_disabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/forward_disabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/back_enabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_both.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/back_disabled.png
/home/user/Selenium_new/Staf/target/site/serenity/9f364046fc0272688aa06a3fb71b8ded_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/644d968b7f1b2979841ae07223d1f860_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/85fcef5aa335c83a53d5d31da56b9fe3_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/29e3a91e22d17dc12be045deae496d93_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_glass_45_0078ae_1x400.p
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_056b93_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_gloss-wave_75_2191c0_50
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_d8e7f3_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_glass_55_f8da4e_1x400.p
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_flat_55_999999_40x100.p
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_0078ae_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_glass_75_79c9ec_1x400.p
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_e0fdff_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_inset-hard_100_fcfdfd_1
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_f5e175_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_fcd113_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_gloss-wave_45_e14f1c_50
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_f7a50d_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_gloss-wave_50_6eac2c_50
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_flat_75_aaaaaa_40x100.p
/home/user/Selenium_new/Staf/target/site/serenity/1dff59ff9f9aeacc1158f993154c5780_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/jit/css/col2.png
/home/user/Selenium_new/Staf/target/site/serenity/jit/css/col1.png
/home/user/Selenium_new/Staf/target/site/serenity/jit/css/gradient.png
/home/user/Selenium_new/Staf/target/site/serenity/acca1aa0392b5b4061b7010cbdf78d25_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/c47b46d36817b6d09b332d03237f41c1_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/8b059de51307d713150b9bff578302ef_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/demo/images/dev7logo.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/light/arrows.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/light/bullets.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/default/arrows.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/default/bullets.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/bar/arrows.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/bar/bullets.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/dark/arrows.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/dark/bullets.png
/home/user/Selenium_new/Staf/target/site/serenity/97e00cdb9c0e090e8f012cca67fc38e2_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/23d7196aa4430b6e75bd6c7106693cc1_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/6cc23a7c739909acd59a723e16e56c9c_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/92052104972408175031d00e90a48543_NONE.png


Question1: How to get all the images present only in the directory(serenity), not images from sub-directories (images,datatables,.....etc)?



/home/user/Selenium_new/Staf/target/site/serenity/97e00cdb9c0e090e8f012cca67fc38e2_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/23d7196aa4430b6e75bd6c7106693cc1_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/6cc23a7c739909acd59a723e16e56c9c_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/92052104972408175031d00e90a48543_NONE.png


Question2: How to copy only those above images(directory Images) to another directory (/home/user/temp)?










share|improve this question
























  • I wonder if something like sudo grep -rnw /root/pictures/ -e .png, *.jpg -exec mv /root/pictures/.png /etc/folder would work
    – hello moto
    Nov 23 at 12:35















up vote
0
down vote

favorite












Excuse me for my Bad english.I want to copy only images(.png) present inside a specific directory(serenity) ignoring the sub-directories(datatables, images..etc,) in that, to another directory.



  find /home/user/Selenium_new/Staf/target/site/serenity/ -iname "*.png"


I used the above command to get all the images present inside the serenity directory, but it is also fetching images for sub-directories as well.The result of the command is:



/home/user/Selenium_new/Staf/target/site/serenity/images/success.png
/home/user/Selenium_new/Staf/target/site/serenity/images/menu_h.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-chrome.png
/home/user/Selenium_new/Staf/target/site/serenity/images/ico-q.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-appium.png
/home/user/Selenium_new/Staf/target/site/serenity/images/cross.png
/home/user/Selenium_new/Staf/target/site/serenity/images/small-middle.png
/home/user/Selenium_new/Staf/target/site/serenity/images/fail.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-iexplorer.png
/home/user/Selenium_new/Staf/target/site/serenity/images/screen.png
/home/user/Selenium_new/Staf/target/site/serenity/images/ignor.png
/home/user/Selenium_new/Staf/target/site/serenity/images/menu_s.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-remote.png
/home/user/Selenium_new/Staf/target/site/serenity/images/worker.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-phantomjs.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-safari.png
/home/user/Selenium_new/Staf/target/site/serenity/images/serenity-bdd-logo.png
/home/user/Selenium_new/Staf/target/site/serenity/images/video.png
/home/user/Selenium_new/Staf/target/site/serenity/images/small-middle-right.png
/home/user/Selenium_new/Staf/target/site/serenity/images/tick.png
/home/user/Selenium_new/Staf/target/site/serenity/images/plus.png
/home/user/Selenium_new/Staf/target/site/serenity/images/pending.png
/home/user/Selenium_new/Staf/target/site/serenity/images/menu_f.png
/home/user/Selenium_new/Staf/target/site/serenity/images/skip.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-provided.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-htmlunit.png
/home/user/Selenium_new/Staf/target/site/serenity/images/links_menu.png
/home/user/Selenium_new/Staf/target/site/serenity/images/minus.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-opera.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-firefox.png
/home/user/Selenium_new/Staf/target/site/serenity/9f5dedcc05678478e7511bb10f9fe15d_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/4a6c5da6264596f2e28453381a0958a2_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/d08552dd3fc9a718eda02eb432d35db1_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/2e756d0187d17ff7ede129c0cd26d5ed_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/3781a9f41cb06adbf2bcab99315e5016_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/jqtree/0.22/jqtree-circle.png
/home/user/Selenium_new/Staf/target/site/serenity/e4a22a00e04d0f54c7306e49a88e3a2c_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/0683540c982a0550834aaea79d71942a_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/76007c6a74590dce97d26dedf8344926_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/ab38399ff5f8b5222e8106c805b97e14_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/fb0cb5df5880626b23643f399bfc5b62_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_asc.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_desc.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/forward_enabled_hover.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_desc_disabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/forward_enabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/back_enabled_hover.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_asc_disabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/forward_disabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/back_enabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_both.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/back_disabled.png
/home/user/Selenium_new/Staf/target/site/serenity/9f364046fc0272688aa06a3fb71b8ded_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/644d968b7f1b2979841ae07223d1f860_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/85fcef5aa335c83a53d5d31da56b9fe3_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/29e3a91e22d17dc12be045deae496d93_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_glass_45_0078ae_1x400.p
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_056b93_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_gloss-wave_75_2191c0_50
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_d8e7f3_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_glass_55_f8da4e_1x400.p
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_flat_55_999999_40x100.p
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_0078ae_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_glass_75_79c9ec_1x400.p
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_e0fdff_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_inset-hard_100_fcfdfd_1
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_f5e175_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_fcd113_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_gloss-wave_45_e14f1c_50
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_f7a50d_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_gloss-wave_50_6eac2c_50
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_flat_75_aaaaaa_40x100.p
/home/user/Selenium_new/Staf/target/site/serenity/1dff59ff9f9aeacc1158f993154c5780_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/jit/css/col2.png
/home/user/Selenium_new/Staf/target/site/serenity/jit/css/col1.png
/home/user/Selenium_new/Staf/target/site/serenity/jit/css/gradient.png
/home/user/Selenium_new/Staf/target/site/serenity/acca1aa0392b5b4061b7010cbdf78d25_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/c47b46d36817b6d09b332d03237f41c1_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/8b059de51307d713150b9bff578302ef_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/demo/images/dev7logo.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/light/arrows.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/light/bullets.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/default/arrows.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/default/bullets.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/bar/arrows.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/bar/bullets.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/dark/arrows.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/dark/bullets.png
/home/user/Selenium_new/Staf/target/site/serenity/97e00cdb9c0e090e8f012cca67fc38e2_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/23d7196aa4430b6e75bd6c7106693cc1_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/6cc23a7c739909acd59a723e16e56c9c_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/92052104972408175031d00e90a48543_NONE.png


Question1: How to get all the images present only in the directory(serenity), not images from sub-directories (images,datatables,.....etc)?



/home/user/Selenium_new/Staf/target/site/serenity/97e00cdb9c0e090e8f012cca67fc38e2_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/23d7196aa4430b6e75bd6c7106693cc1_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/6cc23a7c739909acd59a723e16e56c9c_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/92052104972408175031d00e90a48543_NONE.png


Question2: How to copy only those above images(directory Images) to another directory (/home/user/temp)?










share|improve this question
























  • I wonder if something like sudo grep -rnw /root/pictures/ -e .png, *.jpg -exec mv /root/pictures/.png /etc/folder would work
    – hello moto
    Nov 23 at 12:35













up vote
0
down vote

favorite









up vote
0
down vote

favorite











Excuse me for my Bad english.I want to copy only images(.png) present inside a specific directory(serenity) ignoring the sub-directories(datatables, images..etc,) in that, to another directory.



  find /home/user/Selenium_new/Staf/target/site/serenity/ -iname "*.png"


I used the above command to get all the images present inside the serenity directory, but it is also fetching images for sub-directories as well.The result of the command is:



/home/user/Selenium_new/Staf/target/site/serenity/images/success.png
/home/user/Selenium_new/Staf/target/site/serenity/images/menu_h.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-chrome.png
/home/user/Selenium_new/Staf/target/site/serenity/images/ico-q.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-appium.png
/home/user/Selenium_new/Staf/target/site/serenity/images/cross.png
/home/user/Selenium_new/Staf/target/site/serenity/images/small-middle.png
/home/user/Selenium_new/Staf/target/site/serenity/images/fail.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-iexplorer.png
/home/user/Selenium_new/Staf/target/site/serenity/images/screen.png
/home/user/Selenium_new/Staf/target/site/serenity/images/ignor.png
/home/user/Selenium_new/Staf/target/site/serenity/images/menu_s.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-remote.png
/home/user/Selenium_new/Staf/target/site/serenity/images/worker.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-phantomjs.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-safari.png
/home/user/Selenium_new/Staf/target/site/serenity/images/serenity-bdd-logo.png
/home/user/Selenium_new/Staf/target/site/serenity/images/video.png
/home/user/Selenium_new/Staf/target/site/serenity/images/small-middle-right.png
/home/user/Selenium_new/Staf/target/site/serenity/images/tick.png
/home/user/Selenium_new/Staf/target/site/serenity/images/plus.png
/home/user/Selenium_new/Staf/target/site/serenity/images/pending.png
/home/user/Selenium_new/Staf/target/site/serenity/images/menu_f.png
/home/user/Selenium_new/Staf/target/site/serenity/images/skip.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-provided.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-htmlunit.png
/home/user/Selenium_new/Staf/target/site/serenity/images/links_menu.png
/home/user/Selenium_new/Staf/target/site/serenity/images/minus.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-opera.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-firefox.png
/home/user/Selenium_new/Staf/target/site/serenity/9f5dedcc05678478e7511bb10f9fe15d_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/4a6c5da6264596f2e28453381a0958a2_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/d08552dd3fc9a718eda02eb432d35db1_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/2e756d0187d17ff7ede129c0cd26d5ed_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/3781a9f41cb06adbf2bcab99315e5016_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/jqtree/0.22/jqtree-circle.png
/home/user/Selenium_new/Staf/target/site/serenity/e4a22a00e04d0f54c7306e49a88e3a2c_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/0683540c982a0550834aaea79d71942a_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/76007c6a74590dce97d26dedf8344926_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/ab38399ff5f8b5222e8106c805b97e14_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/fb0cb5df5880626b23643f399bfc5b62_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_asc.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_desc.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/forward_enabled_hover.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_desc_disabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/forward_enabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/back_enabled_hover.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_asc_disabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/forward_disabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/back_enabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_both.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/back_disabled.png
/home/user/Selenium_new/Staf/target/site/serenity/9f364046fc0272688aa06a3fb71b8ded_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/644d968b7f1b2979841ae07223d1f860_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/85fcef5aa335c83a53d5d31da56b9fe3_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/29e3a91e22d17dc12be045deae496d93_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_glass_45_0078ae_1x400.p
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_056b93_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_gloss-wave_75_2191c0_50
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_d8e7f3_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_glass_55_f8da4e_1x400.p
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_flat_55_999999_40x100.p
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_0078ae_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_glass_75_79c9ec_1x400.p
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_e0fdff_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_inset-hard_100_fcfdfd_1
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_f5e175_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_fcd113_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_gloss-wave_45_e14f1c_50
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_f7a50d_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_gloss-wave_50_6eac2c_50
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_flat_75_aaaaaa_40x100.p
/home/user/Selenium_new/Staf/target/site/serenity/1dff59ff9f9aeacc1158f993154c5780_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/jit/css/col2.png
/home/user/Selenium_new/Staf/target/site/serenity/jit/css/col1.png
/home/user/Selenium_new/Staf/target/site/serenity/jit/css/gradient.png
/home/user/Selenium_new/Staf/target/site/serenity/acca1aa0392b5b4061b7010cbdf78d25_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/c47b46d36817b6d09b332d03237f41c1_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/8b059de51307d713150b9bff578302ef_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/demo/images/dev7logo.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/light/arrows.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/light/bullets.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/default/arrows.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/default/bullets.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/bar/arrows.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/bar/bullets.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/dark/arrows.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/dark/bullets.png
/home/user/Selenium_new/Staf/target/site/serenity/97e00cdb9c0e090e8f012cca67fc38e2_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/23d7196aa4430b6e75bd6c7106693cc1_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/6cc23a7c739909acd59a723e16e56c9c_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/92052104972408175031d00e90a48543_NONE.png


Question1: How to get all the images present only in the directory(serenity), not images from sub-directories (images,datatables,.....etc)?



/home/user/Selenium_new/Staf/target/site/serenity/97e00cdb9c0e090e8f012cca67fc38e2_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/23d7196aa4430b6e75bd6c7106693cc1_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/6cc23a7c739909acd59a723e16e56c9c_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/92052104972408175031d00e90a48543_NONE.png


Question2: How to copy only those above images(directory Images) to another directory (/home/user/temp)?










share|improve this question















Excuse me for my Bad english.I want to copy only images(.png) present inside a specific directory(serenity) ignoring the sub-directories(datatables, images..etc,) in that, to another directory.



  find /home/user/Selenium_new/Staf/target/site/serenity/ -iname "*.png"


I used the above command to get all the images present inside the serenity directory, but it is also fetching images for sub-directories as well.The result of the command is:



/home/user/Selenium_new/Staf/target/site/serenity/images/success.png
/home/user/Selenium_new/Staf/target/site/serenity/images/menu_h.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-chrome.png
/home/user/Selenium_new/Staf/target/site/serenity/images/ico-q.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-appium.png
/home/user/Selenium_new/Staf/target/site/serenity/images/cross.png
/home/user/Selenium_new/Staf/target/site/serenity/images/small-middle.png
/home/user/Selenium_new/Staf/target/site/serenity/images/fail.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-iexplorer.png
/home/user/Selenium_new/Staf/target/site/serenity/images/screen.png
/home/user/Selenium_new/Staf/target/site/serenity/images/ignor.png
/home/user/Selenium_new/Staf/target/site/serenity/images/menu_s.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-remote.png
/home/user/Selenium_new/Staf/target/site/serenity/images/worker.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-phantomjs.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-safari.png
/home/user/Selenium_new/Staf/target/site/serenity/images/serenity-bdd-logo.png
/home/user/Selenium_new/Staf/target/site/serenity/images/video.png
/home/user/Selenium_new/Staf/target/site/serenity/images/small-middle-right.png
/home/user/Selenium_new/Staf/target/site/serenity/images/tick.png
/home/user/Selenium_new/Staf/target/site/serenity/images/plus.png
/home/user/Selenium_new/Staf/target/site/serenity/images/pending.png
/home/user/Selenium_new/Staf/target/site/serenity/images/menu_f.png
/home/user/Selenium_new/Staf/target/site/serenity/images/skip.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-provided.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-htmlunit.png
/home/user/Selenium_new/Staf/target/site/serenity/images/links_menu.png
/home/user/Selenium_new/Staf/target/site/serenity/images/minus.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-opera.png
/home/user/Selenium_new/Staf/target/site/serenity/images/driver-firefox.png
/home/user/Selenium_new/Staf/target/site/serenity/9f5dedcc05678478e7511bb10f9fe15d_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/4a6c5da6264596f2e28453381a0958a2_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/d08552dd3fc9a718eda02eb432d35db1_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/2e756d0187d17ff7ede129c0cd26d5ed_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/3781a9f41cb06adbf2bcab99315e5016_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/jqtree/0.22/jqtree-circle.png
/home/user/Selenium_new/Staf/target/site/serenity/e4a22a00e04d0f54c7306e49a88e3a2c_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/0683540c982a0550834aaea79d71942a_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/76007c6a74590dce97d26dedf8344926_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/ab38399ff5f8b5222e8106c805b97e14_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/fb0cb5df5880626b23643f399bfc5b62_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_asc.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_desc.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/forward_enabled_hover.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_desc_disabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/forward_enabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/back_enabled_hover.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_asc_disabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/forward_disabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/back_enabled.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/sort_both.png
/home/user/Selenium_new/Staf/target/site/serenity/datatables/1.10.4/media/images/back_disabled.png
/home/user/Selenium_new/Staf/target/site/serenity/9f364046fc0272688aa06a3fb71b8ded_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/644d968b7f1b2979841ae07223d1f860_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/85fcef5aa335c83a53d5d31da56b9fe3_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/29e3a91e22d17dc12be045deae496d93_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_glass_45_0078ae_1x400.p
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_056b93_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_gloss-wave_75_2191c0_50
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_d8e7f3_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_glass_55_f8da4e_1x400.p
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_flat_55_999999_40x100.p
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_0078ae_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_glass_75_79c9ec_1x400.p
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_e0fdff_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_inset-hard_100_fcfdfd_1
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_f5e175_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_fcd113_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_gloss-wave_45_e14f1c_50
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-icons_f7a50d_256x240.png
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_gloss-wave_50_6eac2c_50
/home/user/Selenium_new/Staf/target/site/serenity/jqueryui/1.11.2-start/images/ui-bg_flat_75_aaaaaa_40x100.p
/home/user/Selenium_new/Staf/target/site/serenity/1dff59ff9f9aeacc1158f993154c5780_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/jit/css/col2.png
/home/user/Selenium_new/Staf/target/site/serenity/jit/css/col1.png
/home/user/Selenium_new/Staf/target/site/serenity/jit/css/gradient.png
/home/user/Selenium_new/Staf/target/site/serenity/acca1aa0392b5b4061b7010cbdf78d25_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/c47b46d36817b6d09b332d03237f41c1_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/8b059de51307d713150b9bff578302ef_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/demo/images/dev7logo.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/light/arrows.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/light/bullets.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/default/arrows.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/default/bullets.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/bar/arrows.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/bar/bullets.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/dark/arrows.png
/home/user/Selenium_new/Staf/target/site/serenity/nivo-slider/3.2/themes/dark/bullets.png
/home/user/Selenium_new/Staf/target/site/serenity/97e00cdb9c0e090e8f012cca67fc38e2_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/23d7196aa4430b6e75bd6c7106693cc1_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/6cc23a7c739909acd59a723e16e56c9c_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/92052104972408175031d00e90a48543_NONE.png


Question1: How to get all the images present only in the directory(serenity), not images from sub-directories (images,datatables,.....etc)?



/home/user/Selenium_new/Staf/target/site/serenity/97e00cdb9c0e090e8f012cca67fc38e2_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/23d7196aa4430b6e75bd6c7106693cc1_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/6cc23a7c739909acd59a723e16e56c9c_NONE.png
/home/user/Selenium_new/Staf/target/site/serenity/92052104972408175031d00e90a48543_NONE.png


Question2: How to copy only those above images(directory Images) to another directory (/home/user/temp)?







command-line directory find cp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 at 12:38









Ravexina

30.6k1478106




30.6k1478106










asked Nov 23 at 12:31









current_user

1054




1054












  • I wonder if something like sudo grep -rnw /root/pictures/ -e .png, *.jpg -exec mv /root/pictures/.png /etc/folder would work
    – hello moto
    Nov 23 at 12:35


















  • I wonder if something like sudo grep -rnw /root/pictures/ -e .png, *.jpg -exec mv /root/pictures/.png /etc/folder would work
    – hello moto
    Nov 23 at 12:35
















I wonder if something like sudo grep -rnw /root/pictures/ -e .png, *.jpg -exec mv /root/pictures/.png /etc/folder would work
– hello moto
Nov 23 at 12:35




I wonder if something like sudo grep -rnw /root/pictures/ -e .png, *.jpg -exec mv /root/pictures/.png /etc/folder would work
– hello moto
Nov 23 at 12:35










2 Answers
2






active

oldest

votes

















up vote
6
down vote













Why even use find?



cp /path/to/dir/*.png /path/to/secondDir/


Copies all png images from the first to the second dir.






share|improve this answer










New contributor




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

























    up vote
    4
    down vote













    If you want to use find for whatever reason and not the cp then you have to use -maxdepth option with 1:



    find /path/to/directory -type f -maxdepth 1 -iname "*.png"


    It only look to the directory specified and not the sub directories.



    To copy:



    find /path/to/directory -type f -maxdepth 1 -iname "*.png" -exec cp {} /home/user/temp ;



    -maxdepth levels

    Descend at most levels (a non-negative integer) levels of directories below the
    starting-points.







    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "89"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














       

      draft saved


      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1095369%2fcopy-only-images-in-a-specific-directory-ignoring-the-sub-directories-in-it%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      6
      down vote













      Why even use find?



      cp /path/to/dir/*.png /path/to/secondDir/


      Copies all png images from the first to the second dir.






      share|improve this answer










      New contributor




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






















        up vote
        6
        down vote













        Why even use find?



        cp /path/to/dir/*.png /path/to/secondDir/


        Copies all png images from the first to the second dir.






        share|improve this answer










        New contributor




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




















          up vote
          6
          down vote










          up vote
          6
          down vote









          Why even use find?



          cp /path/to/dir/*.png /path/to/secondDir/


          Copies all png images from the first to the second dir.






          share|improve this answer










          New contributor




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









          Why even use find?



          cp /path/to/dir/*.png /path/to/secondDir/


          Copies all png images from the first to the second dir.







          share|improve this answer










          New contributor




          Turtle10000 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 answer



          share|improve this answer








          edited Nov 23 at 19:42









          Ravexina

          30.6k1478106




          30.6k1478106






          New contributor




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









          answered Nov 23 at 12:43









          Turtle10000

          865




          865




          New contributor




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





          New contributor





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






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
























              up vote
              4
              down vote













              If you want to use find for whatever reason and not the cp then you have to use -maxdepth option with 1:



              find /path/to/directory -type f -maxdepth 1 -iname "*.png"


              It only look to the directory specified and not the sub directories.



              To copy:



              find /path/to/directory -type f -maxdepth 1 -iname "*.png" -exec cp {} /home/user/temp ;



              -maxdepth levels

              Descend at most levels (a non-negative integer) levels of directories below the
              starting-points.







              share|improve this answer



























                up vote
                4
                down vote













                If you want to use find for whatever reason and not the cp then you have to use -maxdepth option with 1:



                find /path/to/directory -type f -maxdepth 1 -iname "*.png"


                It only look to the directory specified and not the sub directories.



                To copy:



                find /path/to/directory -type f -maxdepth 1 -iname "*.png" -exec cp {} /home/user/temp ;



                -maxdepth levels

                Descend at most levels (a non-negative integer) levels of directories below the
                starting-points.







                share|improve this answer

























                  up vote
                  4
                  down vote










                  up vote
                  4
                  down vote









                  If you want to use find for whatever reason and not the cp then you have to use -maxdepth option with 1:



                  find /path/to/directory -type f -maxdepth 1 -iname "*.png"


                  It only look to the directory specified and not the sub directories.



                  To copy:



                  find /path/to/directory -type f -maxdepth 1 -iname "*.png" -exec cp {} /home/user/temp ;



                  -maxdepth levels

                  Descend at most levels (a non-negative integer) levels of directories below the
                  starting-points.







                  share|improve this answer














                  If you want to use find for whatever reason and not the cp then you have to use -maxdepth option with 1:



                  find /path/to/directory -type f -maxdepth 1 -iname "*.png"


                  It only look to the directory specified and not the sub directories.



                  To copy:



                  find /path/to/directory -type f -maxdepth 1 -iname "*.png" -exec cp {} /home/user/temp ;



                  -maxdepth levels

                  Descend at most levels (a non-negative integer) levels of directories below the
                  starting-points.








                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 23 at 12:44

























                  answered Nov 23 at 12:34









                  Ravexina

                  30.6k1478106




                  30.6k1478106






























                       

                      draft saved


                      draft discarded



















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1095369%2fcopy-only-images-in-a-specific-directory-ignoring-the-sub-directories-in-it%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                      Mangá

                       ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕