LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-02-2007, 04:17 AM   #1
vatsan1
LQ Newbie
 
Registered: Aug 2007
Posts: 10

Rep: Reputation: 0
a little scripting help needed!!


guys i need bit of help!!

i am writing a script which finds files that have not been accessed for a no of days and delete those files...the no of days value is inputted at the command line....

i am using the following :
find $1 -atime +7 -exec rm -i

in the second step i want to copy all of those files that the above line finds to a list and archive them using GNU tar...once i archive these files i can go on and delete them.....Also the archive name should include the date so that a existing archive not be overwritten...

any help guys????
 
Old 09-02-2007, 04:30 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Post what you got already? (Preferably in BB code tags)
 
Old 09-02-2007, 04:36 AM   #3
vatsan1
LQ Newbie
 
Registered: Aug 2007
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn View Post
Post what you got already? (Preferably in BB code tags)



i can find files that have not been acessed for a number ofdays...i dont know how to put these files in a list and archive them using gnu tar...
 
Old 09-02-2007, 04:40 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Oh well. FILELIST=$(find /some/dir --some-args-that-only-output-absolute-names 2>/dev/null); tar --some-args /some/tarball "${FILELIST}"

Last edited by unSpawn; 09-02-2007 at 04:41 AM.
 
Old 09-02-2007, 06:24 AM   #5
vatsan1
LQ Newbie
 
Registered: Aug 2007
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn View Post
Oh well. FILELIST=$(find /some/dir --some-args-that-only-output-absolute-names 2>/dev/null); tar --some-args /some/tarball "${FILELIST}"

Not Working mate!!
 
Old 09-02-2007, 07:04 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Well, that certainly is sad to hear. Luckily there's other things to do like building a Radius server, Oracle cluster or just work on World Domination.
 
Old 09-02-2007, 08:50 AM   #7
bmarx
Member
 
Registered: Dec 2004
Distribution: Slackware, Arch, FreeBSD
Posts: 202

Rep: Reputation: 34
try removing the quotations and brackets from the FILELIST argument. i.e. tar --args $FILELIST quoting will keep the \n from the original find command. Try doing:

echo $FILELIST
echo "$FILELIST"
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash scripting help needed Zylar Linux - Newbie 8 05-03-2007 08:32 AM
Scripting Help needed - IP Enumeration AnonyMooseUK Programming 11 10-22-2006 10:17 AM
shell scripting - help needed jonhewer Linux - Newbie 54 09-09-2005 02:58 PM
bash scripting --- some help needed rajsharma Linux - Software 1 09-09-2005 02:49 AM
Scripting help needed. stonelee Linux - Software 2 09-29-2003 09:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10: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
Open Source Consulting | Domain Registration