LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-07-2001, 12:12 AM   #1
icorsi
LQ Newbie
 
Registered: Oct 2001
Posts: 3

Rep: Reputation: 0
Deleting the newly created files keeping the existing


Hi,
How are you? I am trying to write a small unix program using unix shell script. I came upon your website by doing a search on unix help. I use Linux, Red Hat 7.1, any help will be appreciated. Thanks.

Suppose I have a working folder called “DIR1” under that folder I have three existing files : FILE1, FILE2, FILE3, for a project.
Now after I compile those files and build two other new files were created : NEW1, NEW2.
I am writing a program/shell script which will verify all 5 FILES ( 3 existing and 2 newly created). This program will delete the newly created 2 files(NEW1,NEW2) and leave the previously existing 3 files (FILE1, FILE2, FILE3) unchanged. Another words the directory “DIR1” will go back to it’s original status.
 
Old 10-07-2001, 12:23 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 271Reputation: 271Reputation: 271
please do not double post... you might want to ask this in the programming forum... and i closed it in the general forum cause of the double posts..
 
Old 10-07-2001, 11:16 AM   #3
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 47
How are you planning to decide which are the new and old files? By their timestamps yeah? If you are going to do this how are you going to decde which ones you keep, or will you always keep the oldest 2/3 files??

I think you need to provide a little more detail... If you are just going to erase all files newer then a specific time then you can just use the find command to removing them (by making it call rm for each matched file).

cheers

Jamie...
 
  


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
saving newly created files using ftp on a network linuxhippy Slackware 5 05-06-2005 03:54 AM
permissions for newly created files dialbat Linux - General 2 10-04-2004 02:58 PM
Can we access the newly created files after dd if=hda6_last_mon_backup of=/dev/hda6 murugesan Linux - Software 0 03-29-2004 08:42 AM
snort error: newly created file is older than distributed files! rufassa Linux - Security 1 11-07-2003 08:53 AM
Deleting newly created files keeping the existing ones icorsi Linux - General 0 10-07-2001 12:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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