LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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

Reply
 
Search this Thread
Old 05-10-2007, 11:39 PM   #1
KevinAlaska
Member
 
Registered: May 2004
Location: Alaska, USA
Distribution: Fedora Core 4 - RedHat
Posts: 42

Rep: Reputation: 15
Question How can I type a command that does the following?


Hello and thank you first off for reading my post.

I have ubuntu 7 and I have recently imported from about 5 different backups from several different computers on my home network photos using fstop photo manager.

This program if you have not used it can import photos from selected locations. I have selected all these backups because I am not sure which files are not double, triples etc of the same photo.

So once the import is done it places all the newly copied photos from the import into my ubuntu gnome home folder called "photos".

If there are double that are imported into the "photo" folder (which I should add. all photos imported are put into subfolders by date for example a photo from January 15, 2002 would be put into a folder /photo/2002/01/15/) these duplicates are renamed with a *-1.jpg, *-2.jpg, *-3.jpg etc. The '*'would be the original photos name in its place.

So here is my question...

How can I type a command that would go in and delete all files with the -1.jpg at the end of the files name or -2, -3 etc and in all the subdirectories or maybe move them into a single folder. I just need to get them out of there. The idea of scrolling through 10k of photos and deleting them all one by one sounds like NASTY work to me.

Thanks for your help and time on this issue.

Cheers and best wishes from me.

Sincerely,

Kevin in Alaska
 
Old 05-10-2007, 11:44 PM   #2
fukawi2
Member
 
Registered: Oct 2006
Location: Melbourne, Australia
Distribution: ArchLinux, ArchServer, Fedora, CentOS
Posts: 448

Rep: Reputation: 34
To find all the photos named like that:
Code:
find /home/username/photo -type f -iname \*-1.jpg -print
To move them elsewhere
Code:
find /home/username/photo -type f -iname \*-1.jpg -exec mv -vf {} /home/username/duplicate-photos \;
To delete them:
Code:
find /home/username/photo -type f -iname \*-1.jpg -exec rm -Rfv {} \;
 
Old 05-10-2007, 11:46 PM   #3
KevinAlaska
Member
 
Registered: May 2004
Location: Alaska, USA
Distribution: Fedora Core 4 - RedHat
Posts: 42

Original Poster
Rep: Reputation: 15
SWEET.. thank you SOOOOO much.

I knew there was a way. And awesome fast responce to my post. Under 5 minutes.

Thanks a mill!!!

Cheers
 
Old 05-10-2007, 11:54 PM   #4
fukawi2
Member
 
Registered: Oct 2006
Location: Melbourne, Australia
Distribution: ArchLinux, ArchServer, Fedora, CentOS
Posts: 448

Rep: Reputation: 34
Pleasure.. Glad to help. Gotta have something to do at work :P

Linux looks after my servers so well - work is dead quiet these days
 
Old 05-10-2007, 11:58 PM   #5
KevinAlaska
Member
 
Registered: May 2004
Location: Alaska, USA
Distribution: Fedora Core 4 - RedHat
Posts: 42

Original Poster
Rep: Reputation: 15
HAH!... That was funny.

Well if you don't mind a little down relaxing 'time to surf linuxqustions.org' time then thats GREAT!

I know some hate that but personally I don't mind it if I can keep busy in ways 'I' want to.

But again if severs are doing great then that means Linux and people are doing there jobs just fine.

I wish I had your job and mostly your knowledge of Linux.

Thanks again ALL the same.

Sincerely,

Kevin in Alaska
 
  


Reply

Tags
cleanup, delete, duplicates, exec, find, fspot, photo, rm


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
type sudo command then i cant type in a password turoblaztr Linux - General 5 01-14-2007 09:58 AM
command to see RAM type curos Linux - General 2 03-15-2006 10:00 AM
Is there a command for finding out the filesystem type? nodger Linux - Software 2 03-04-2005 03:04 PM
what command do I type Mr. Mojo Risin Linux - Hardware 4 07-26-2004 03:24 PM
file type from command line?? wr3ck3d Linux - General 4 03-12-2003 01:48 PM


All times are GMT -5. The time now is 08:44 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration