You are not logged in.
Hi there
I don't know what's wrong with this: find . -atime +3 | tar -czvf tarfile.tar.gz
PS: I want to write a simple script to find the files which haven't been visited for 3 days and compress them.
Never laugh at me.....I'm just a beginner to learn shell.:/
Last edited by YZMSQ (2009-12-28 13:14:37)
This is the way the world ends
Not with a bang but a whimper
-------T·S·Eliot
Offline
tar can read filenames from a file with -T where - will be stdin. So
find . -type f -atime +3 | tar cfz tar.tgz -T -
Note that find will print . without -type f or -mindepth 1, which would add everything at least once.
Offline
Another possibility is to use the xargs command to build a parameter string from stdin.
find . -name something | xargs tar -cf allsomethings.tar
Last edited by tlvb (2009-12-27 17:07:16)
I need a sorted list of all random numbers, so that I can retrieve a suitable one later with a binary search instead of having to iterate through the generation process every time.
Offline
Thank you very much for your help!!!
This is the way the world ends
Not with a bang but a whimper
-------T·S·Eliot
Offline
But what's wrong with this command line: find . -atime +3 -ok tar -czvf tarfile.tar.gz {} \;
I need your help,please.
This is the way the world ends
Not with a bang but a whimper
-------T·S·Eliot
Offline
But what's wrong with this command line: find . -atime +3 -ok tar -czvf tarfile.tar.gz {} \;
I need your help,please.
with that, tar -czvf will be executed lots of times, once for every file that matches the criteria. what you want is either a list of files to tar with one command, or to add individual files to an existing archive
"You can watch for your administrator to install the latest kernel with watch uname -r" - From the watch man page
Offline
thank you for your help!
This is the way the world ends
Not with a bang but a whimper
-------T·S·Eliot
Offline