LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   the diff command or any other similar things (http://www.linuxquestions.org/questions/linux-newbie-8/the-diff-command-or-any-other-similar-things-45052/)

murshed 02-12-2003 04:06 AM

the diff command or any other similar things
 
hi all..

i have a huge directory with many subfolders and many files in each folder ..

i usually back up the directory each week .. usually it is a full back up ...

offcourse i add some files or even subfolders in this main folder during the week ... and i would like to KNOW the NEW files that have been added each time i do the backup ..

well .. i made this small script :


tar -czvf backup.tar.gz MainFolder/ > temp.txt


this script will simply show whatever was displayed on the screen in a file called temp.txt ...

the next time i do a run this script .. it will generate a new file called temp.txt .. ofcourse i would take a copy of the first temp.txt or change its name so it wont overwrite it.

now we have two temp files that have some difference in them ..

to know the difference .. we run the diff command ... this is known



the problem is that the diff command will result i having a big file that has all these:
>>
<<
>>
<<

things on it ... and for huge files ... this won't be a practical way of knowing the new files


my questions is .. is there any way to have a txt file that sows clearly what new files are added? or deleted?

when i say clearly i mean .. no >> or << .. .only lines of the number of new files added or deleted ...

thanks in advance:)

Mara 02-12-2003 04:20 AM

Maybe you need a CVS? Then you can simply (from console or using GUI frontend) see which files were modified, when, which are new and so on. ANd allows you to see modifications between version. Very useful, but I'm not sure if that's what you want.

Mik 02-12-2003 09:37 AM

Why not just use --newer

tar -czvf backup.tar.gz --newer="2003-02-10 12:00:00" MainFolder/

You could always place the timestamp of the last archive in a file. Something like:
date +"%Y-%m-%d %H:%M:%S" > /tmp/lastarchived

Then when you archive you can run the command:
tar -czvf backup.tar.gz --newer=`cat /tmp/lastarchived`MainFolder/

murshed 02-12-2003 09:46 AM

Mara .. hmmmmmmmmm isn't this something used for projects and programming versions?? is there any thing simpler?

Mik .. well .. i knew the time stamp thingy but i wasn't remembring the right command .. so i said in this post i'll just make sure to change the name:)

thanks alot:)

any other suggestions?

cuckoopint 02-12-2003 10:07 PM

would the -u (update) option do the job for you? maybe you should read "man tar" to see what fits your needs.


All times are GMT -5. The time now is 09:49 AM.