LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 04-26-2015, 05:05 PM   #1
blackturbo
LQ Newbie
 
Registered: Apr 2015
Posts: 4

Rep: Reputation: Disabled
trouble deleting old files


Hello all, Iam having trouble on my linux VPS. I currently running a game server, and want to clear out old user accounts in the user directory. All the user (player accounts ) end with *.ini , I was trying to clear them out past 120 days old. here are the commands I was using.

find /home/ogp_agent/6666/samp03/scriptfiles/ZMA/Users* -mtime +120 -delete

find /home/ogp_agent/6666/samp03/scriptfiles/ZMA/Users -mtime +120 -exec rm {} \;

find /home/ogp_agent/6666/samp03/scriptfiles/ZMA/Users/* -mtime +120 -exec rm -f {} \;

I wasnt getting any error messages, it acted like it performed the cmd, but I still have player accounts that are older than 120 days. Iam using CentOS 6.5 x32 , can somewon tell me a better command to use, those commands is all I can find on google search and they dont work for me. thank you!
Mark
 
Old 04-26-2015, 09:43 PM   #2
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
If you include an asterisk in the search key, enclose the file spec in double quotes.

Run the find command without the rm {} and see what find lists. It should list the files you want to delete. If it doesn't you condition is wrong. Test on a known set of files.

jlinkels
 
Old 05-02-2015, 10:59 AM   #3
blackturbo
LQ Newbie
 
Registered: Apr 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
i dont understand, what would you type? the files are located here /home/ogp_agent/6666/samp03/scriptfiles/ZMA/Users/ , and the files are .ini files and i wanna delete them after 120 days old. thanks
 
Old 05-02-2015, 01:42 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,745

Rep: Reputation: 5924Reputation: 5924Reputation: 5924Reputation: 5924Reputation: 5924Reputation: 5924Reputation: 5924Reputation: 5924Reputation: 5924Reputation: 5924Reputation: 5924
jlinkels was trying to help you determine if your command was actually working as expected. However, your syntax is not correct. You can find many examples of how to use the find command on the web.

find /path/to/files -name "*.ini"

http://www.binarytides.com/linux-find-command-examples/
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Deleting files rmcellig Linux - Newbie 13 11-26-2010 06:26 AM
Trouble Deleting Hidden Partition on External Drive jman82s Linux - Hardware 2 11-27-2007 06:48 PM
Deleting old files shiroh_1982 Linux - Newbie 2 06-21-2006 07:26 AM
trouble deleting files / directories neocontrol Linux - Software 1 07-16-2005 04:09 PM
Deleting files in C monil Programming 4 03-13-2005 10:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 12:48 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