Extension Development :: Script required to delete a list of files?



In order to upgrade the versions of bison, pkg-config, expat, etc in compile-3.3.5, it would make life a lot easier if I had a script to delete a list of files. This would avoid starting again from the beginning and would avoid the hit or miss approach of hoping the new version of an app would completely overwrite the old version of an app.

If a list of files is produced by:
Code Sample
$ ./configure --prefix=/opt/test
$ make
$ touch mymarker
# make install
$ sudo find / -not -type 'd' -cnewer mymarker | grep -v "\/proc\/" | tee files

- then I was thinking I could replace "/opt/test/" with "/opt/compile-3.3.5/" in "files" and then call a script that would delete all the files in "files"

I would guess this would only require a couple of lines, but it is beyond my (almost non-existant) scripting ability...

Why not uninstall them?

If you still have the source tree that has the same configure options, you can run `make uninstall`

Ah, thanks - this did the trick:
Code Sample
$ ./configure --same options as when compiled
$ make
# make uninstall

Quote (Juanito @ April 13 2008,05:30)
Ah, thanks - this did the trick:
Code Sample
$ ./configure --same options as when compiled
$ make
# make uninstall

Well, if you're just reconfiguring it, you don't need to build it - just do make uninstall right after.
Just to answer the original question, I find myself typing loops on the command line to process lists. Example:

# for F in `cat myfiles.lst`; do echo "$F"; done

This just echos back your list to insure that the loop is typed correctly.

I always start with a simple echo; just to be sure.

Sometimes I am paranoid and will then replace the echo with ls -1 to be sure that files that I think I am going to be processing are really there.

Then when I calm down I replace the command (echo or ls -1) with the actual command I wish to perform, usually sed -i, tr,awk, or rm

I know many times one could use find together with -exec, but that is not always available, so too, one could use find with xargs but I still uses loops on the command line.

Next Page...
original here.