Gjob83 Posted April 19, 2009 at 08:54 PM Report #257690 Posted April 19, 2009 at 08:54 PM Bom dia, Pretendo fazer um script que compacte em tar.gz todos os ficheiros .txt que já foram alterados à mais de 10 dias. Alguem me pode ajudar? cumprimentos
Baderous Posted April 19, 2009 at 11:12 PM Report #257693 Posted April 19, 2009 at 11:12 PM Tens de usar o comando find e o tar: find /dir -name '.*txt' Isto procura e lista todos ficheiros cuja extensão seja .txt que estejam na directoria dir. find /dir -mtime +10 Isto procura e lista todos ficheiros na directoria dir que foram modificados há mais de 10 dias. tar czfv Test.tar.gz Test/ Isto comprime a pasta Test em Teste.tar.gz Agora é só juntar isto.
Sven Posted April 22, 2009 at 12:15 AM Report #258113 Posted April 22, 2009 at 12:15 AM Tou um pouco enferrujado em shell script mas é como o Baderous disse , algo assim find /path -name \*.txt -mtime +10 | xargs tar czvf arquivo.tgz Writing software is more fun than workingO covil do Barão
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now