Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
ok, so i do need the backslash before the *.jpg, i think i got it.
now if right below my root level of where all the folders were at, my first level of subfolders all started with numbers, then had some random text, then a year, is there any way to do this for say all folders directly beneath that root level (and those folders subsequent subfolders) that start with 04 then have some text then 2009?
Be sure you read the `xargs' man page. There are 3 options that deal with limiting the number of arguments (filenames) that xargs receives. If you have thousands of files or hundreds of very long filenames, you could have bash run out of memory.
'04*2009/*.jpg' I guess, if I understand what you meant.
link under my main folder, i would have the following subfolders as an example
04birthday2009
05birthday2009
04kids2009
and i'd only want to do it for jpg's under the first and third folder since they start with 04 then have 2009 in them. i dont care what the subfolder names are below those.
and now i'm confused again, not surprised, by the last two posts. so am i doing it wrong then? none of my file names should have spaces in them, but i'd rather have this account for them i suppose, in case i use this for something in the future.
and now i'm confused again, not surprised, by the last two posts. so am i doing it wrong then? none of my file names should have spaces in them, but i'd rather have this account for them i suppose, in case i use this for something in the future.
If you are talking about the -print0/-0, yes, you should use those as well, they never hurt. I should have used them in first place.
My examples will work almost always for a reason, even with spaces: because xargs is using -i and the {} are correctly quoted. However, even then, there's *one* corner case where they will not work, and the null termination will.
It's the rare case when a name of the file has a carry return on it (yes, in linux you can do that).
so if i want to do it for a group of folders like i said in a couple posts ago, i would put this?? is that the right slash or do i need single quotes around the one part?
so if i want to do it for a group of folders like i said in a couple posts ago, i would put this?? is that the right slash or do i need single quotes around the one part?
to only do it in folders (and all their subfolders) who are one level beneath where i'm running this command from, only when the folder names (one level down from where i'm running the command from) begin with 04 then have some text then end in 2009
it almost looks like this last one is just going to get the jpg's that have 04 then some text then 2009 then some text then .jpg or .JPG etc in the name, rather than looking at the top folder they are in's name.
Yeah, I just tried to do the find part from that second statement. it doesn't work right, it looks in folders with the wrong name.
say i have /photos
then
/photos/04birthday2009
/photos/05birthday2009
/photos/04kids2009
Then under each one of those three are 10 subfolders with random names
What I want to be able to do is move them based on the 04 and the 2009 in that 2nd level directory structure. So i want to somehow use this command to move only jpg's under (whether in that folder or levels down from it) the two 04*2009 named folders.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.