Register a domain and help support LQ
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-04-2005, 10:41 AM   #1
Senior Member
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,619

Rep: Reputation: 49
need a script to delete all files from a directory and all subdirectories


I need a perl script or bash to delete ALL files from a directory
and from ALL subdirectories, but it should NOT delete any directories & subdirectories.


Last edited by cccc; 06-08-2005 at 07:38 PM.
Old 03-04-2005, 10:54 AM   #2
Senior Member
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 45
hi there,

not the complete solution but i give you the direction...
find /your_path/ -type f -print | rm -f -
i used print cause you can check before.




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
bash script to delete files c0d3 Programming 9 12-05-2004 10:45 PM
How to make JHEAD work on all subfolders within a folder SupaDucta Linux - Newbie 0 11-26-2004 06:02 PM
Delete old files and folders Script? AsteX Linux - General 4 11-11-2004 06:26 PM
changeing permissions for a folder + subfolders and files ? YBA^[x] Slackware 7 08-06-2004 04:07 AM
Script on linux to delete certain files ForumKid Linux - General 2 06-22-2002 01:09 PM

All times are GMT -5. The time now is 12:41 PM.

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