LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-07-2007, 01:38 PM   #1
n_hendrick
Member
 
Registered: Jan 2004
Location: Canal Fulton OH.
Distribution: Ubuntu 15.04, Gentoo
Posts: 68

Rep: Reputation: 15
sorting through large file directories


hey all....just wanted to ask a stupid question. I have a directory thats full of duplicate files with different names. Most of the files have been labeled with like beta1 beta2 tags. I want to wipe out all the betas in my directory and just be left with the standard filename. I could go through in nautilus and manually delete each name but I have about 20,000 files. As you see this would take all day. I'm wandering if there is an easier way to sort the files out of the directory that I want to keep (the files without tags) then just delete the rest....
 
Old 05-07-2007, 01:41 PM   #2
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,410

Rep: Reputation: 141Reputation: 141
Here's what I'd do just to make sure I didn't lose anything I wanted to keep:
Code:
mkdir junk
mv beta* junk
ls
Check the result of ls. Move any additional files you want to delete to junk. Once you have everything that you want to keep in the current directory, then run:
Code:
rm -r junk
 
Old 05-07-2007, 01:48 PM   #3
kaz2100
Senior Member
 
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: SlackWare > Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy .. bullseye bookworm
Posts: 1,848

Rep: Reputation: 108Reputation: 108
Hey n/hendrick... just wanted to reply a stupid answer. You have a directory thats full of duplicate files with different names. Most of the files have been labeled with like beta 1 beta 2 tags. You want to wipe out all the betas in your directory and just be left with the standard filename. You could go through in nautilus and manually delete each name but You have about 20,000 files. As you see this would take all day. You're wondering if there is an easier way to sort the files out of the directory that You want to keep (the files without tags) then just delete the rest....

Code:
find /your/path/to/directory/with/20000/files -name \*beta\* -exec mv {} /your/path/to/directory/to/delete/ \;
Then take 2 days to check that you do not need these files in /your/path/to/directory/to/delete/ and delete them.

Happy Penguins!

Last edited by kaz2100; 05-07-2007 at 01:51 PM.
 
Old 05-07-2007, 01:51 PM   #4
Centinul
Member
 
Registered: Jun 2005
Distribution: Gentoo
Posts: 552

Rep: Reputation: 30
This may work:

Code:
find /<some>/<directory> -print | xargs grep beta1 | xargs rm -i
**WARNING** This hasn't been tested.

HTH,

Centinul
 
Old 05-08-2007, 12:08 PM   #5
n_hendrick
Member
 
Registered: Jan 2004
Location: Canal Fulton OH.
Distribution: Ubuntu 15.04, Gentoo
Posts: 68

Original Poster
Rep: Reputation: 15
Thanks a load guys that just saved me a day of work....thanks. Hey kaz I'm kinda familiar with shell scripting what does the \ in the elfacto do for the command? also I was curious about the {} and the ending argument \; You don't have to explain it to me I was just curious....but hey thanks again.

Last edited by n_hendrick; 05-08-2007 at 12:29 PM.
 
  


Reply


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting large text files tmaxx AIX 14 02-19-2009 06:32 PM
moving large directories over to linux from windows ghostz00 Ubuntu 7 12-11-2006 03:38 PM
CIFS Mount not showing large directories (file counts). damber Linux - Networking 3 11-24-2006 10:13 AM
Sorting Amarok Collection into directories nicholas.perkins Linux - Software 3 11-09-2005 06:12 PM
Nautilus hangs in large media directories Maestro485 Fedora 4 11-14-2004 01:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration