DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 25th June 2008
plexter plexter is offline
Shell Scout
 
Join Date: May 2008
Posts: 124
Default Delete Files By Schedule Continued

Hello all again,

I have run into some issues with my script and now require to change my strategy with the linked situation. I'm hoping someone will be able to assist?

Please refer to the forum post for details:

http://daemonforums.org/showthread.php?t=651

Basically the above works fine in itself. However now we will require the ability to skip some directories.

Ideally it would be nice to be able to first generate a list of all the directories. All the directories would be kept in a MySQL database (for other reasons) this could be done with a SQL query I'm sure. In the SQL database we will have a field that says delete or not delete basically. Is there someway we can then adapt this to work in the same way and delete files on a schedule excluding "not delete"?

Is it possible to have RM or FIND read from a text file?

I am thinking it would be ideal to issue a SQL query to export all entries with "DELETE" and then have RM read from the exported txt file. (if possible?)

Does anyone have any idea how I can do this effectively?

Thanks so much!

Last edited by plexter; 25th June 2008 at 05:13 PM.
Reply With Quote
  #2   (View Single Post)  
Old 25th June 2008
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 3,318
Default

Quote:
Originally Posted by plexter View Post
Ideally it would be nice to be able to first generate a list of all the directories. All the directories would be kept in a MySQL database...
cron(8) can run scripts or binaries. Given that your requirements continue to evolve, I would suggest that you move now to a fuller, more sophistated scripting language such as Perl or Python which can read directly from databases as well as text files.
Quote:
Is it possible to have RM or FIND read from a text file?
Scripts can construct commands which are based partly on information maintained in a text file.
Reply With Quote
  #3   (View Single Post)  
Old 27th June 2008
plexter plexter is offline
Shell Scout
 
Join Date: May 2008
Posts: 124
Default

Thanks for the reply.

I am not so familiar with those langs I suppose I can try using PHP though.

Thanks
Reply With Quote
  #4   (View Single Post)  
Old 27th June 2008
ephemera's Avatar
ephemera ephemera is offline
Knuth's homeboy
 
Join Date: Apr 2008
Posts: 537
Default

if you provide more (exact) details maybe we could suggest a quick script.
Reply With Quote
  #5   (View Single Post)  
Old 28th June 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

You can do it through PHP -- it's actually quite a nice language for stuff if you know what your doing.

short run & delete Perl/PHP/SQL scripts can also save bandwidth when manipulating files on a remote server, if ssh access is unavailable but ftp/sftp is.


btw -- xargs is a great friend for feeding data into rm and programs with similiar usage styles ;-)
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
Reply

Thread Tools
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
FreeBSD console delete key graudeejs FreeBSD General 4 24th August 2008 01:37 PM
Cannot delete it.... graudeejs FreeBSD General 9 20th July 2008 12:45 PM
Delete Files By Schedule plexter OpenBSD General 12 4th June 2008 10:15 PM
How to delete account? khdf Feedback and Suggestions 5 9th May 2008 09:05 PM


All times are GMT. The time now is 11:07 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick