[SOLVED] Cleaning out folders....

The place to post if you need help or advice

Moderators: ChrisThornett, LXF moderators

[SOLVED] Cleaning out folders....

Postby thusgaard » Sat Jan 19, 2013 6:01 pm

Hi

I have taken pictures with 2 webcams for a timelapse video.
The PC and cameras had a few problems along the way....
So I have 2 folders with 2300+ images in each, but they don't match 100%.

So I need to run a clean up job.
The pictures are all named the same way, and pictures taken at the same time has the same name in both folders (but different size content and time stamp)

All of my files are put into PIXLeft and PIXRight They are named in the following way: "2013-01-11-08:58:28.jpg" if the process was ok at the time there will be a picture of that name in each folder.

I need to clean out the pictures that dosn't have a name match in the other folder.

I've been eksperimenting with code like this:
Code: Select all
ls ./PIXLeft > left
ls ./PIXRight > right
diff -s left right


It does give me a list of differences, but how do I move all the files that dosn't have a match to a new folder?

J;-)
Last edited by thusgaard on Sat Jan 19, 2013 7:44 pm, edited 1 time in total.
thusgaard
LXF regular
 
Posts: 102
Joined: Wed Jun 07, 2006 10:21 am
Location: Skanderborg, Denmark

Postby MartyBartfast » Sat Jan 19, 2013 6:12 pm

I would probably do something like

Code: Select all
$ cd PIXLeft/
$ for file in `ls -1` ; do [ -f ../PIXRight/${file} ] || mv  $file /somefolder/ ; done

$ cd ../PIXRight/
$ for file in `ls -1` ; do [ -f ../PIXLeft/${file} ] || mv  $file /somefolder/ ; done



after which PIXLeft and PIXRight should only contain files which are common to both, and /somefolder/ will contain all files which only existed in one folder but not both.

(make a backup of the folders first just in case something goes badly wrong :wink: )
I have been touched by his noodly appendage.
User avatar
MartyBartfast
LXF regular
 
Posts: 815
Joined: Mon Aug 22, 2005 7:25 am
Location: Hants, UK

Postby thusgaard » Sat Jan 19, 2013 6:19 pm

MartyBartfast wrote:I would probably do something like

Code: Select all
$ cd PIXLeft/
$ for file in `ls -1` ; do [ -f ../PIXRight/${file} ] || mv  $file /somefolder/ ; done

$ cd ../PIXRight/
$ for file in `ls -1` ; do [ -f ../PIXLeft/${file} ] || mv  $file /somefolder/ ; done



after which PIXLeft and PIXRight should only contain files which are common to both, and /somefolder/ will contain all files which only existed in one folder but not both.

(make a backup of the folders first just in case something goes badly wrong :wink: )



I'll be testing later tonight. Pictures are already backed up on 2 memory sticks and a drop box. Travled 2500 km to get these 2 sets of pictures so I wont be fooling around with them....
thusgaard
LXF regular
 
Posts: 102
Joined: Wed Jun 07, 2006 10:21 am
Location: Skanderborg, Denmark

Postby thusgaard » Sat Jan 19, 2013 6:37 pm

thusgaard wrote:
MartyBartfast wrote:I would probably do something like

Code: Select all
$ cd PIXLeft/
$ for file in `ls -1` ; do [ -f ../PIXRight/${file} ] || mv  $file /somefolder/ ; done

$ cd ../PIXRight/
$ for file in `ls -1` ; do [ -f ../PIXLeft/${file} ] || mv  $file /somefolder/ ; done



after which PIXLeft and PIXRight should only contain files which are common to both, and /somefolder/ will contain all files which only existed in one folder but not both.

(make a backup of the folders first just in case something goes badly wrong :wink: )



I'll be testing later tonight. Pictures are already backed up on 2 memory sticks and a drop box. Travled 2500 km to get these 2 sets of pictures so I wont be fooling around with them....


Worked like a charm.

Now I just need to figure out how to make the merge comman merge them so that i'll get a nice wide picture for my video.

I did something like this while shooting the pictures:

Code: Select all
montage -geometry '+0+0' -background 'none' /home/jesper/pix0.jpg /home/jesper/pix1.jpg /home/jesper/pixmerge/"$DATE.jpg"


So I guess I need to make montage see my list of files and make replace my paths and folders....
I can't use the ones from the original recording due to the problems with cameras.

J;-)


This solved the merging of pictures:

Code: Select all
for file in `ls -1` ; do montage -geometry '+0+0' -background 'none' /home/jesper/PIXvenstre/${file} /home/jesper/PIXhøjre/${file} /home/jesper/PIXmerge/${file} ; done


So now I just have to follow these instructions: http://ubuntuforums.org/showthread.php?t=2022316
thusgaard
LXF regular
 
Posts: 102
Joined: Wed Jun 07, 2006 10:21 am
Location: Skanderborg, Denmark


Return to Help!

Who is online

Users browsing this forum: Google [Bot] and 0 guests