Article View: comp.sys.next.sysadmin
Article #697Spaces in filenames
From: Brendan T. McNichols
Date: Wed, 12 Aug 1992 18:47
Date: Wed, 12 Aug 1992 18:47
34 lines
1754 bytes
1754 bytes
Hi all,
I have the following script which I modified from an earlier post by Jim
Kiraly to search through the entire filesystem and delete all old files
in .NextTrash directories.
# --- Empty the Recycler(s) --- Changed by Brendan on August 10, 1992
# from an earlier version posted by Jim Kiraly to comp.sys.next.sysadmin
#
# Search through entire filesystem looking for .NextTrash directories.
# Save the list in the variable trashlist. For every .NextTrash directory
# found in the previous command, find and delete all files that are more
# than 1 day old.
trashlist=`find / -type d -name .NextTrash -prune -print`
for j in $trashlist
do
echo 'Removing files more than 1 day old from recycler: '$j
# find $j -ctime +1 -depth -exec rm -rf {};
done
Unfortunatly, the script does not work if one of the paths in the
trashlist variable has a space in it. When the for loop gets to the path
with the space in it, it thinks that the path is actually two paths.
Anyone know how I would go about fixing this problem? Can anyone think
of a better way of writing this script?
Thanks very much in advance,
Brendan
--
Brendan T. McNichols, Computer Support (315) 443-9577
Psyracuse U. Sychology Dept. mcnichol@psy.syr.edu (NeXT)
430 Huntington Hall mcnichol@syr.edu
Syracuse, NY 13244
Technical Details
Message-ID:
<1992Aug12.144727.17189@newstand.syr.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!psinntp!newstand.syr.edu!mcnichol@terminator.psy.syr.eduShow Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.sysadmin From: mcnichol@terminator.psy.syr.edu (Brendan T. McNichols) Subject: Spaces in filenames Message-ID: <1992Aug12.144727.17189@newstand.syr.edu> Reply-To: mcnichol@mailbox.syr.edu Path: arc1-ca.pugleaf.net!sparky!uunet!psinntp!newstand.syr.edu!mcnichol@terminator.psy.syr.edu Date: Wed, 12 Aug 92 14:47:27 EDT Lines: 34