Linux Command Help - Sorting Photographs

Messages
718
Edit My Images
Yes
Hi all...

I'm after some help with a linux command/script? I know nothing about linux but this is what I would like to do...

I have two folders full of photographs:

Folder 1 (HQ Photographs)

1. Pic101Processed
2. Pic102Processed
3. Pic103Processed
4. Pic104Processed
5. Pic105Processed

Folder 2: (Resized Photographs)

1. Pic101ProcessedResized
2. Pic102ProcessedResized
3. Pic103ProcessedResized
4. Pic104ProcessedResized
5. Pic105ProcessedResized

After I resize the photographs, I go through them picking out the ones I would like to use! To which it then looks like this:

Folder 1 (HQ Photographs - Still remains the same)

1. Pic101Processed
2. Pic102Processed
3. Pic103Processed
4. Pic104Processed
5. Pic105Processed

Folder 2: (Resized Photographs)

1. Pic101ProcessedResized
3. Pic103ProcessedResized
5. Pic105ProcessedResized

I'm looking to copy/move all the hq photographs I have in Folder 1 that I used/picked out for folder 2 into a separate folder called "HQ Photographs Used). However as you can see the filenames are different, apart from the first Picxxx part?

So now it looks like this:

Folder 2: (Resized Photographs)

1. Pic101ProcessedResized
3. Pic103ProcessedResized
5. Pic105ProcessedResized

Folder 3 : (HQ Photographs Used)

1. Pic101Processed
2. Pic103Processed
3. Pic105Processed

Is there anyway I could achieve this? Currently I'm just comparing both folders and dragging the hq photographs I used into a separate folder called "HQ photographs Used" which takes a while as I tend to have about 1000 photographs.

Thanks if you can help

Ed :)
 
I am sure there will be a nice way to write a shell script to help you do this, but life is too short for me to learn Linux I'm afraid. I am sure there is a Guru out there that could to this while sleeping.

Did you try finding a Linux forum, they are all nice people, just don't mention Windoze to them or they won't stop laughing :)
 
If you put them all in one folder you could use the mv command i.e.
mv Pic101* ~newfolder
mv Pic101* Pic103* /pics/newfolder

or something like that.

Just a thought, the syntax might not be quite right but I think I am close.
 
I could easily write a python script to do it for you from the command line if you wish? Exactly how you want it presently. Most linux distros come with python already so you wouldn't need to install it. Check that you have python, if so and want a quick script doing let me know. :)
 
you can do this ...
cut and paste it into an xterm .. I'm assuming you are running bash or sh
if you use a different shell then the for command construct will be different.
I've used different folder names to hopefully make it clear whats wot

Code:
for photo in Folder2_resized/*
do
    photoStub=`echo $photo | sed 's/Resized//'`
    mv Folder1_HQ/$photoStub* Folder3_Used
done

Its quite simple.

The for..do....done loop looks at all of the entries in folder2 taking each in turn as the variable "photo".

The "sed" bit reduces the name of the photo in the 2nd folder to match the one in the first. Or at least be short enough to uniquely identify it.

"mv" moves A->B (you could equally use cp).


[ I spend most days doing things like this... :)]
 
Thank you sooo much for your help,

However me being a newbie to Macs, Mac is developed in Unix right?

Can anyone tell me how would I go about inputting the above on a MAC? On a pc its just start-run-cmd! Then you can command away?

How do I do this on a Mac? Running Tiger 10.4...

Again thanks again for your help, its much appreciated.

Ed :)
 
Back
Top