Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


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

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

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
LQ Guru
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 250Reputation: 250Reputation: 250
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
Senior Member
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 46
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).




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 > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:45 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration