Look at the man page for the find command and use the -printf option in
find instead of the -print option.
--
-Time flies like the wind. Fruit flies like a banana. Stranger things have -
-happened but none stranger than this. Does your driver's license say Organ
-Donor?Black holes are where God divided by zero. Listen to me! We are all-
-individuals! What if this weren't a hypothetical question? [EMAIL PROTECTED]
On Tue, 31 Jul 2001, Joe Gaude wrote:
=>Hello,
=>I've got a cronjob on my ftp server that runs this script:
=>
=>
=>#!/bin/sh
=>set -x
=>
=># quickie to move old files to storage and wipe really old stored files
=>
=>BASE=/var/ftp/ # base tree
=>USERS=users # user accounts
=>STORAGE=storage # storage area
=>RECENT=3 # age of "recent" files
=>(move)
=>OLD=30 # age of "old" files (wipe)
=>
=>cd $BASE # go to top level
=>
=># find all recent files and throw them to storage
=>RECENTFILES=`find $USERS -type f -mtime +$RECENT -print` # find files
=>tar cpf - "$RECENTFILES" | (cd $STORAGE ; tar xpf -) # copy 'em
=>#rm -f $RECENTFILES # wipe the originals
=>
=># find all old files and wipe 'em
=>find $STORAGE -type f -mtime +$OLD -print | xargs rm -f
=>
=>The error output is:
=>
=>+ BASE=/var/ftp/
=>+ USERS=users
=>+ STORAGE=storage
=>+ RECENT=3
=>+ OLD=30
=>+ cd /var/ftp/
=>++ find users -type f -mtime +3 -print
=>+ RECENTFILES=users/ftp1/VPN3000 Universal.zip
=>users/rick-PCBA/fab drawings for 410-00047 rev 11.zip
=>users/rick-PCBA/Gerbers 410-00047.zip
=>+ tar cpf - 'users/ftp1/VPN3000 Universal.zip
=>users/rick-PCBA/fab drawings for 410-00047 rev 11.zip
=>users/rick-PCBA/Gerbers 410-00047.zip'
=>tar: users/ftp1/VPN3000 Universal.zip\nusers/rick-PCBA/fab drawings for
=>410-00047 rev 11.zip\nusers/rick-PCBA/Gerbers 410-00047.zip: Cannot stat: No
=>such file or directory
=>+ cd storage
=>+ tar xpf -
=>tar: Error exit delayed from previous errors
=>+ find storage -type f -mtime +30 -print
=>+ xargs rm -f
=>
=>
=>
=>What I can't get to work is file names with spaces in them. Tar splits up
=>the names. Can someone tell me how to accomplish this?
=>
=>Thanks,
=>
=>...Joe
=>
=>
=>
=>
=>Joseph A. Gaude' - Comm Tech
=>707-766-3244 direct
=>707-283-3244 personal fax
=>[EMAIL PROTECTED]
=>
=>1035 N. McDowell Blvd.
=>Petaluma, CA 94954
=>Ph: 707-766-3000
=>Fax: 707-766-3100 company fax
=>http://www.calix.com
=>
=>
=>
=>_______________________________________________
=>Seawolf-list mailing list
=>[EMAIL PROTECTED]
=>https://listman.redhat.com/mailman/listinfo/seawolf-list
=>
_______________________________________________
Seawolf-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/seawolf-list