LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2011, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 13 Jan 2011 10:10:09 -0600
Reply-To:     "Data _null_;" <iebupdte@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Data _null_;" <iebupdte@GMAIL.COM>
Subject:      Re: Files in a directory (without X)
Comments: To: John Hendrickx <john2.hendrickx@gmail.com>
In-Reply-To:  <AANLkTim121zWvgBQYt1Lso9LBOGjDjLd_zRcbayvw40w@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

filename dirlist '.';

data _null_; did = dopen('dirlist'); do i = 1 to dnum(did); dread = dread(did,i); rc = filename('FT08F001',dread); did2 = dopen('FT08F001'); if did2 ne 0 then put 'NOTE: Directory ' dread=; rc = dclose(did2); rc = filename('FT08F001'); end; run;

On Thu, Jan 13, 2011 at 10:05 AM, John Hendrickx <john2.hendrickx@gmail.com> wrote: > Yes, I simplified my story somewhat. X, pipe can be enabled in EG but > they aren't at this site and the sysops don't want to enable them. > From http://www.phuse.eu/download.aspx?type=cms&docID=256 > > Statements such as X, %SYSEXEC, SYSTASK and CALL SYSTEM, the SYSTEM > function, and the FILENAME option PIPE will not work unless the > -ALLOWXCMD or -NONOXCMD parameters are explicitly added to the Object > Spawner configuration. > > This would be fine with me if there was an easy alternative way to > perform common tasks like cleaning up a directory. But the external > file functions aren't complete enough to do this > > 2011/1/13 Suzanne McCoy <Suzanne.McCoy@catalinamarketing.com>: >> This stored procedure runs just fine and it was developed in EG. >> >> * Â Begin EG generated code (do not edit this line); >> * >> * Â Stored process registered by >> * Â Enterprise Guide Stored Process Manager V4.2 >> * >> * Â ==================================================================== >> * Â Stored process name: RunningSASProcesses >> * >> * Â Description: What SAS related processes are currently active on the >> * Â  Â  Â  Â  Â  Â  Â  server? >> * Â ==================================================================== >> *; >> >> >> OPTIONS VALIDVARNAME=ANY; >> >> >> filename ps_list pipe "ps -ef |grep 'sas'"; >> >> data sasjobs; >> Â  infile ps_list; >> Â  length process $ 300; >> Â  input process $ char300.; >> run; >> >> ods html body=_webout; >> ods listing close; >> title1 "&SERVER"; >> >> proc print data=sasjobs; >> run; >> >> ods html close; >> ods listing; >> >> -----Original Message----- >> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of John Hendrickx >> Sent: Thursday, January 13, 2011 10:23 AM >> To: SAS-L@LISTSERV.UGA.EDU >> Subject: Re: Files in a directory (without X) >> >> No, I can't use the pipe command in Enterprise Guide >> >> 2011/1/13 Suzanne McCoy <Suzanne.McCoy@catalinamarketing.com>: >>> filename pics pipe "ls -1 &queue_dir./tmp/IMAGES/"; *something like this should give you what you need; >>> >>> -----Original Message----- >>> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of John Hendrickx >>> Sent: Thursday, January 13, 2011 9:56 AM >>> To: SAS-L@LISTSERV.UGA.EDU >>> Subject: Re: Files in a directory (without X) >>> >>> I don't think doptname can help me or anyone else for that matter. >>> From http://support.sas.com/documentation/cdl/en/hostwin/63285/HTML/default/viewer.htm#win-func-doptname.htm >>> >>> DOPTNAME(directory-id, nval ) >>> Under Windows, the only directory information item that is available >>> is Directory, which is the pathname of directory-id. The nval, or >>> sequence number, of Directory is 1. >>> >>> I would have thought that foptname would be able to show if a file is >>> a directory or not. FOPTNAME can be used to determine the LRECL and >>> RECFM of files but not whether it's a directory or not. >>> >>> 2011/1/13 Arthur Tabachneck <art297@rogers.com>: >>>> John, >>>> >>>> That same paper describes the doptname function. � Couldn't that be used to >>>> do what you need? >>>> >>>> Art >>>> -------- >>>> On Thu, 13 Jan 2011 11:51:56 +0100, John Hendrickx >>>> <john2.hendrickx@GMAIL.COM> wrote: >>>> >>>>>I'm using the enterprise guide so I can't use the X command or pipe >>>>>statement but I'd like to use my SAS program to delete the files in a >>>>>certain directory. I found a useful paper >>>>>"http://www2.sas.com/proceedings/forum2007/054-2007.pdf" on using >>>>>DREAD, etc. that provides a solution that ALMOST works. The problem >>>>>is, it doesn't distinguish between files and directories. I've >>>>>searched the SAS documentation but I can't find a way to either >>>>>restrict DREAD to files or to distinguish between files and >>>>>directories. >>>>> >>>>>Here's an example gleaned from Linda Libeg's paper: >>>>> >>>>>filename dirlist "C:\logs"; >>>>> >>>>>%macro ttt(libref); >>>>> � � � %let dirid = %sysfunc(DOPEN(&libref)); >>>>> � � � /* �dircnt� contains the number of files in the directory */ >>>>> � � � %let dircnt = %sysfunc(DNUM(&dirid)); >>>>> � � � %do i = 1 %to &dircnt; >>>>> � � � � � � � %let dirread = %sysfunc(DREAD(&dirid,&i)); >>>>> � � � � � � � %put dirread = &dirread; >>>>> � � � %end; >>>>> >>>>> � � � %let rc =%sysfunc(DCLOSE(&dirid)); >>>>>%mend; >>>>>%ttt(dirlist); >>>>> >>>>>This works, but &dirread can be a file or a subdirectory. Does anyone >>>>>know a way to restrict it to files onlt? >>>> >>> >> >


Back to: Top of message | Previous page | Main SAS-L page