Need some rsync help

I have been rtfm and searching on the web, but I can’t figure this one out.

I want to:

  • recurse through a set of directories
  • copy two types of files (*.jpg and *.cr2)
  • to one flat directory (ie without preserving the original directory structure)

Either my google fu is broken today or nobody else wants to copy files without preserving the directory structure… so I am asking here if someone knows the correct rsync recipe for this. Or another app that will do this :slight_smile:

I’ve found find and copy all images in directory using terminal linux mint, trying to understand syntax - Stack Overflow using my fu since I was intrigued by your question, it has some explanation to, there might be better examples / tools tho.

Thanks! This is a good example of something I was exploring. I understand the *nix philosophy of having small utilities doing one thing well, but it seems a convoluted solution to, imho, a fairly straight forward action.

I’m not a programmer, nor a script writer. I guess that when one has the skills to make a stable program with a usable interface the skills to just pipe some commands together takes way less time and then we are here

2 Likes

It’s not convoluted at all, if you want more GUI noob way of doing it, then simple fireup some graphical file manager, search all “.jpg” select them all and then cut and paste them in a different location.

That’s maybe easier for you but way more convoluted than a oneliner.

For the moment I have settled on this oneliner that seems to do the trick for me:

find . \( -name "*.jpg" -or -name "*.jpeg" -or -name "*.gif" -or -name "*.cr2" -or -name "*.mp4" -or -name "*.mov" -or -name "*.gp3" \) -exec cp -n {} /new/directory/location \;

1 Like