Date: Fri, 22 Feb 2008 13:34:10 -0500
Reply-To: Chang Chung <chang_y_chung@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Chang Chung <chang_y_chung@HOTMAIL.COM>
Subject: Re: deleting empty files in a catalog
On Fri, 22 Feb 2008 02:34:53 -0500, Joe Whitehurst <joewhitehurst@GMAIL.COM>
wrote:
>Then your macro can coded with just Base/SAS and be as simple as the
>following which makes a list of the files with gt 0 records from the
>currenty directory. With minor alterations you can obtain a list of
>filenames with exactly 0 records and use the fdelete function from SCL which
>can be used in a datastep with sysfunc, or, alternatively, you can use a
>operating system command to delete the files.
...
hi,
this seems to be too much since cmd shell can do it in a command, for, like
below, which deletes all the zero-byte sized files in the current folder,
z:\test:
z:\test> for %f in (*.*) do if %~zf EQU 0 del %f
You can issue this command within sas via x statement and others. notice the
single quotes which prevent sas from trying to macro expanding &'s and %'s.
Yes, the ampersand(&) character is the cmd shell command delimiter.
x 'z:&cd test&for %f in (*.*) do if %~zf EQU 0 del %f';
cheers,
chang
|