LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices



Reply
 
Search this Thread
Old 11-23-2005, 06:13 AM   #1
bianchi
Member
 
Registered: Nov 2005
Location: Italy
Posts: 36

Rep: Reputation: 15
Question Remove ALL files from specific Directory


How can I Remove ALL files in a specific Directory ?

grazie,
Bianchi
 
Old 11-23-2005, 06:39 AM   #2
fouldsy
Senior Member
 
Registered: Jan 2002
Location: St Louis, MO
Distribution: Ubuntu
Posts: 1,284

Rep: Reputation: 47
Code:
rm /path/to/directory/*.*
will remove all files, whilst leaving any sub-directories alone. If you wanted to remove the whole directory + sub directories, "rm -rf /path/to/directory/" would do it.
 
Old 11-23-2005, 06:40 AM   #3
raseel
LQ Newbie
 
Registered: Oct 2005
Distribution: Fedora Core 3
Posts: 20

Rep: Reputation: 0
Do you mean other than by doing :
$ rm -rf <dir-path>/*
 
Old 11-23-2005, 06:40 AM   #4
bianchi
Member
 
Registered: Nov 2005
Location: Italy
Posts: 36

Original Poster
Rep: Reputation: 15
I mean in 'c' + wxwidgets
 
Old 11-23-2005, 08:16 AM   #5
bianchi
Member
 
Registered: Nov 2005
Location: Italy
Posts: 36

Original Poster
Rep: Reputation: 15
Found myself :
wxString f = wxFindFirstFile("/home/project/*.*");
while ( !f.empty() )
{
wxRemoveFile ( f );
f = wxFindNextFile();
}
 
Old 11-23-2005, 09:30 AM   #6
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,314

Rep: Reputation: 175Reputation: 175
rm *.* will not work.
that's DOS speak. It will only remove files with a dot in them.
 
Old 11-23-2005, 09:47 AM   #7
bianchi
Member
 
Registered: Nov 2005
Location: Italy
Posts: 36

Original Poster
Rep: Reputation: 15
Thats ok with me , the files have suffix
 
Old 11-23-2005, 03:07 PM   #8
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,214

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
that brings up a moral issue.

i consider it good practice to put an extension in all my files. eventhough it isn't a standard (moreover an m$ windoze standard).

also filenames without spaces, punctuation .except for dot., capitals, '_'s... makes my life easier

what is proper file naming convention
 
Old 11-23-2005, 03:27 PM   #9
fouldsy
Senior Member
 
Registered: Jan 2002
Location: St Louis, MO
Distribution: Ubuntu
Posts: 1,284

Rep: Reputation: 47
Quote:
rm *.* will not work.
that's DOS speak. It will only remove files with a dot in them.
Struggling from too much beer last night, too little sleep, and too many OS' at work in my defence But, depending on what you were removing, it will still work, obviously providing they had an extension...

Last edited by fouldsy; 11-23-2005 at 03:28 PM.
 
Old 11-24-2005, 12:27 AM   #10
bianchi
Member
 
Registered: Nov 2005
Location: Italy
Posts: 36

Original Poster
Rep: Reputation: 15
All of my files which I need to remove are
DOS named , so they contain "." .
so this solution is good for my case ,
if anyone else dont have the same problem , please
change it , so it will suite well.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching a specific directory for a specific extension? RoaCh Of DisCor Linux - Newbie 3 08-13-2005 04:28 PM
How to do recursive file copy of directory for specific files? Arodef Linux - Newbie 4 06-29-2004 06:35 PM
how do i remove a specific program? Blu-star Linux - Software 4 01-04-2004 10:00 PM
Remove directory w/ files kfrancisco Linux - Software 13 10-02-2003 02:40 AM
Remove Files from the Directory .... shib_s Linux - Security 2 08-28-2001 06:53 PM


All times are GMT -5. The time now is 05:14 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration