| View previous topic :: View next topic |
| Author |
Message |
thusgaard
Joined: Wed Jun 07, 2006 11:21 am Posts: 97 Location: Skanderborg, Denmark
|
Posted: Sat Jan 19, 2013 6:01 pm Post subject: [SOLVED] Cleaning out folders.... |
|
|
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?
J
Last edited by thusgaard on Sat Jan 19, 2013 7:44 pm; edited 1 time in total |
|
| Back to top |
|
 |
MartyBartfast LXF regular

Joined: Mon Aug 22, 2005 8:25 am Posts: 785 Location: Hants, UK
|
Posted: Sat Jan 19, 2013 6:12 pm Post subject: |
|
|
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 ) _________________ I have been touched by his noodly appendage. |
|
| Back to top |
|
 |
thusgaard
Joined: Wed Jun 07, 2006 11:21 am Posts: 97 Location: Skanderborg, Denmark
|
Posted: Sat Jan 19, 2013 6:19 pm Post subject: |
|
|
| 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 |
|
 |
thusgaard
Joined: Wed Jun 07, 2006 11:21 am Posts: 97 Location: Skanderborg, Denmark
|
Posted: Sat Jan 19, 2013 6:37 pm Post subject: |
|
|
| 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 previous topic :: View next topic |
|