Wednesday, October 6, 2010

FIND, EXEC and TAR

This is the linux syntax to find some files and add them to an archive:

find . -name '*.cfg' -type f -newer flagfile -exec tar uf backup_it.tar {} \;

'{}' is a placeholder for the name of the file that has been found.

As we want the shell to ignore the semicolon and pass it verbatim to find we have to escape it with '\;'.

An explaination for other special characters can be found here.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...