LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-12-2005, 06:49 AM   #1
eduac
Member
 
Registered: Jun 2003
Distribution: Arch - www.archlinux.org
Posts: 186

Rep: Reputation: 30
remove a folder created 3 days ago.


Fellas,


I have to remove a folder, who has been created a three days ago...how can do this with a bash script? or something like that...?
 
Old 09-12-2005, 07:45 AM   #2
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
Gosh, I hope I'm not missing something here, but why not issue:
rm -rf <directory>
 
Old 09-12-2005, 08:23 AM   #3
wanderingmind
Member
 
Registered: Sep 2005
Location: UK
Distribution: Ubuntu 12.04 LTS
Posts: 76

Rep: Reputation: 16
Quote:
Originally posted by Chinaman
Gosh, I hope I'm not missing something here, but why not issue:
rm -rf <directory>
The -r switch (recursive) is needed when removing directories
The -f switch (force) removes without asking separately about each file.

typing 'man rm' will tell you all about it.
 
Old 09-12-2005, 10:39 AM   #4
sorin25
LQ Newbie
 
Registered: Sep 2005
Location: Romania/Bucharest
Distribution: Ferdora Core 3
Posts: 7

Rep: Reputation: 0
Well, rm will work in such cases, but I think his problem was finding the directory created 3 days ago.
The command appropriate for that is find, switches -mtime and -type will enable you to find the directory created/modified 3 days ago
 
Old 10-17-2005, 11:15 AM   #5
eduac
Member
 
Registered: Jun 2003
Distribution: Arch - www.archlinux.org
Posts: 186

Original Poster
Rep: Reputation: 30
i found the solution:

Code:
find /directory/* -type f -mmin +2800 -exec rm {} \;
where:
-type f -> delete only the regular file's
-mmin +2800 -> File's data was last modified 2800 minutes ago.

thanks for all help
 
  


Reply



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
How to get rid of the no name folder created by Open Office? Linux.tar.gz Linux - Software 8 09-27-2005 02:39 PM
Uninstall or Remove Folder? sall Linux - General 4 08-07-2005 11:35 AM
Linux won't write to a Windows-created folder joshknape Linux - Newbie 6 07-25-2005 10:05 PM
Remove folder and file os2 Programming 1 03-12-2005 02:12 PM
I have 8 character file name, no extension files being created in my dbaseIII+ folder bonzo Linux - General 2 01-22-2004 06:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

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