Article View: comp.sys.next.sysadmin
Article #756Re: Spaces in filenames
From: John Robison
Date: Fri, 14 Aug 1992 19:40
Date: Fri, 14 Aug 1992 19:40
40 lines
1706 bytes
1706 bytes
Brendan T. McNichols writes
> Hi all,
>
> # --- 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.
>
After playing with this for a while, I got the following to work
(Although I used a slightly different command)
Instead of referencing your file to trash as $j,
try referencing it as "${j}". (Include quotes)
This works for direct commands like
/bin/rm "${j}"
You will have to test it for find.
Regards,
John
--
John Robison - john@oceania.com
NeXTMail Gladly Accepted
--> What I say has absolutely nothing to do with
my employer. They don't even know I am posting. <--
Technical Details
Message-ID:
<Bsznzs.1xF@oceania.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!oceania!johnReferences:
<1992Aug12.144727.17189@newstand.syr.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.sysadmin Path: arc1-ca.pugleaf.net!sparky!uunet!oceania!john From: john@oceania.com (John Robison) Subject: Re: Spaces in filenames Message-ID: <Bsznzs.1xF@oceania.com> Sender: john@oceania.com (John Robison) Reply-To: john@oceania.com Organization: Oceania Health Care Systems References: <1992Aug12.144727.17189@newstand.syr.edu> Distribution: usa Date: Fri, 14 Aug 1992 19:40:39 GMT Lines: 40