Jump to content
Sign in to follow this  
Gjob83

Solaris - Shell Script

Recommended Posts

Gjob83

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


"O que não nos mata, torna-nos mais fortes!"

Share this post


Link to post
Share on other sites
Baderous

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.