Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Sorry, I know this is a common question but I can't figure out how to get this to work properly. When I manage it I'll post a recursivity how to to make up for it
I have a photo library program that manages files in a very peculiar way. Organized by year, then month, then something else I can't figure out, then a series of data files, thumbnails, and then below that, in a folder called Originals, are the actual photos.
What I need to do is take every file out of the Originals (nth-subfolder) and cp or mv that to another folder, to they're all in one place.
I'm sure this is a one-liner, can anybody help me ?
So why is mine longer??
I'm not sure if find will match part of the path as the filename (haven't tried it). Also, there may be other files besides images in those directories. The "-path" option pulls the path match out of the filename argument, and the "-iname" part matches any file ending in ".jpg", ".JPG", ".Jpg", etc.
WARNING: Never, never, never run someone else's command (mine included) that moves or deletes files without verifying it works first!!! You can examine what files are selected by changing the above command to:
Code:
find $PHOTOROOT -type f -path "*/Originals/*" -iname "*.jpg"
That will print of list of matching files. You might also consider copying the files over instead of moving them (by replacing the "mv" with "cp" in the first command). Once the files are copied and you're happy, run the exact same command, but tell it to remove the file (again, substitute "rm" for the "cp" and get rid of the $DESTDIR)
And I was going to replace the mvs with cps I wouldn't run a command I wasn't familiar with without first checking what it would do to my entire library, very sound advice !
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.