0

I have two repertories named 'test1' and 'test2' with multiples files with .jpg or .mp3 extensions. I want to find and move all files between 22-juin-2016 and 21-September-2018 to a new folder called 'data'.

How would I be able to do this with one line of command ?

Thank you very much for you help !

Neo Capo
  • 11
  • 4
  • i think we have the same issue (therefore i think we are in the same class huehue :3 ) i did find how to search files in between dates. find . -type f -newermt 2010-10-07 ! -newermt 2014-10-08 that will print on your screen all of the files between the dates. The only issue i had with this command was that i couldn't copy the files to the directory in which they're supposed to go. And as dumb as it sounds (cause copying should be known by now) it just won't work. Can you help me? – user1140542 Oct 22 '20 at 19:34
  • Hey! I found it, so by adding -exec mv -t Folder_Name {} + after your find should move the files. Hope it helps :) – Neo Capo Oct 23 '20 at 03:04
  • Well i'm not sure i truly understand. Cause i need to do it in only one command, do you place the command for the dates in between the {} ? – user1140542 Oct 23 '20 at 03:28
  • it should look like this: find . -type f -newermt 2010-10-07 ! -newermt 2014-10-08 -exec mv -t Folder_Name {} Make sure to put the appropriate dates and change the Folder_Name to the right folder name. – Neo Capo Oct 23 '20 at 04:51
  • Thank you so much! I got it :) – user1140542 Oct 23 '20 at 15:51

0 Answers0