[ale] delete all files but leave folder structure intact

Geoffrey Myers lists at serioustechnology.com
Tue Apr 19 12:22:40 EDT 2011


Lightner, Jeff wrote:
> Picky picky
> 
> Then don't ever do "rm -rf .*"

Sorry, still won't remove the directory you're sitting in:

centosvmfoo> rm -rf .*
rm: cannot remove `.' or `..'
rm: cannot remove `.' or `..'

:)

> 
> -----Original Message-----
> From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of
> Geoffrey Myers
> Sent: Tuesday, April 19, 2011 7:50 AM
> To: Atlanta Linux Enthusiasts
> Subject: Re: [ale] delete all files but leave folder structure intact
> 
> Lightner, Jeff wrote:
>> Also be sure NEVER to do "rm .*" in any directory.   Many a newbie has
>> surprised themselves by trying to remove .profile, .bashrc .mozilla
>> etc... that way.
> 
> Pretty sure that's not going to work as since you're in the directory, 
> you can't remove it.  Further, you can't remove a directory with 'rm' 
> without the recursive option.
> 
> 
>> The ".*" will match ".." which is a hard link to the parent directory
> so
>> tells it to remove a directory above.
>>
>> -----Original Message-----
>> From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of
>> Michael B. Trausch
>> Sent: Monday, April 18, 2011 3:46 PM
>> To: Atlanta Linux Enthusiasts
>> Subject: Re: [ale] delete all files but leave folder structure intact
>>
>> On 04/18/2011 03:22 PM, Ed Cashin wrote:
>>> To read into your question a bit, I'll assume you'd like to remove
>>> special files and symbolic links and named fifos as well as regular
>>> files.
>>>
>>>   find xyz ! -type d -print0 | xargs -0 rm
>> Nice.  I hadn't thought of that.
>>
>> 	--- Mike
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
>>  
>> Proud partner. Susan G. Komen for the Cure.
>>  
>> Please consider our environment before printing this e-mail or
> attachments.
>> ----------------------------------
>> CONFIDENTIALITY NOTICE: This e-mail may contain privileged or
> confidential information and is for the sole use of the intended
> recipient(s). If you are not the intended recipient, any disclosure,
> copying, distribution, or use of the contents of this information is
> prohibited and may be unlawful. If you have received this electronic
> transmission in error, please reply immediately to the sender that you
> have received the message in error, and delete it. Thank you.
>> ----------------------------------
>>
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
> 
> 


-- 
Until later, Geoffrey

"I predict future happiness for America if they can prevent
the government from wasting the labors of the people under
the pretense of taking care of them."
- Thomas Jefferson


More information about the Ale mailing list