FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 06-18-2012, 10:12 PM
Matt
 
Default Deleting Files

I want to safely delete all files in a certain directory that are
exactly 32 characters long. This is on CentOS 5.x. How would I do
that?
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 06-18-2012, 10:22 PM
Frank Cox
 
Default Deleting Files

On Mon, 18 Jun 2012 17:12:34 -0500
Matt wrote:

> I want to safely delete all files in a certain directory that are
> exactly 32 characters long. This is on CentOS 5.x. How would I do
> that?

rm -i ????????????????????????????????


--
MELVILLE THEATRE ~ Real D 3D Digital Cinema ~ www.melvilletheatre.com
www.creekfm.com - FIFTY THOUSAND WATTS of POW WOW POWER!
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 06-19-2012, 03:02 AM
Stephen Harris
 
Default Deleting Files

On Mon, Jun 18, 2012 at 05:12:34PM -0500, Matt wrote:
> I want to safely delete all files in a certain directory that are
> exactly 32 characters long. This is on CentOS 5.x. How would I do
> that?

Let me guess; homework... 'cos this sure ain't a CentOS question!

--

rgds
Stephen
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 06-19-2012, 03:47 PM
Matt
 
Default Deleting Files

>> I want to safely delete all files in a certain directory that are
>> exactly 32 characters long. *This is on CentOS 5.x. *How would I do
>> that?
>
> Let me guess; homework... *'cos this sure ain't a CentOS question!

No, cluttered directory.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 06-20-2012, 12:11 AM
Diego Sanchez
 
Default Deleting Files

find /whe/re -mtime +2 -exec echo {} ;

If you get "Argument list too long" error, you can use

find . -name "*" -print | xargs rm

--
Diego - Yo no soy paranoico! (pero que me siguen, me siguen)
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 06-20-2012, 10:23 AM
Thomas Johansson
 
Default Deleting Files

On 2012-06-20 02:11, Diego Sanchez wrote:
> find /whe/re -mtime +2 -exec echo {} ;
>
> If you get "Argument list too long" error, you can use
>
> find . -name "*" -print | xargs rm
>

Be very careful using that line!

If you have files or directories with whitespace or other special items
in the name it can produce very unexpected behavior. In the case of
whitespaces in filenames a better choise is to use

find . -name '...' -print0 | xargs -0 rm

Look at the man pages for find and xargs for more information.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 06:06 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org