Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[SOLVED] Cleaning out folders....

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Help!
View previous topic :: View next topic  
Author Message
thusgaard
LXF regular


Joined: Wed Jun 07, 2006 11:21 am
Posts: 102
Location: Skanderborg, Denmark

PostPosted: Sat Jan 19, 2013 6:01 pm    Post subject: [SOLVED] Cleaning out folders.... Reply with quote

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:
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?

JWink


Last edited by thusgaard on Sat Jan 19, 2013 7:44 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
MartyBartfast
LXF regular


Joined: Mon Aug 22, 2005 8:25 am
Posts: 814
Location: Hants, UK

PostPosted: Sat Jan 19, 2013 6:12 pm    Post subject: Reply with quote

I would probably do something like

Code:

$ 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.
Back to top
View user's profile Send private message
thusgaard
LXF regular


Joined: Wed Jun 07, 2006 11:21 am
Posts: 102
Location: Skanderborg, Denmark

PostPosted: Sat Jan 19, 2013 6:19 pm    Post subject: Reply with quote

MartyBartfast wrote:
I would probably do something like

Code:

$ 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....
Back to top
View user's profile Send private message Visit poster's website
thusgaard
LXF regular


Joined: Wed Jun 07, 2006 11:21 am
Posts: 102
Location: Skanderborg, Denmark

PostPosted: Sat Jan 19, 2013 6:37 pm    Post subject: Reply with quote

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

Code:

$ 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:
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:
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
Back to top
View user's profile Send private message Visit poster's website
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Help! All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast