<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: deleting files using linux command in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/deleting-files-using-linux-command/m-p/332348#M22070</link>
    <description>&lt;P&gt;You might try the FDELETE function. You would not send the unix command just the name of the file and/or directory:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data _null_;
   set test2;
   rc=fdelete(fname);
   put rc=;
   msg=sysmsg();
   put msg=;
run;&lt;/PRE&gt;
&lt;P&gt;where Fname above is just the name of the directory. The PUT statements show the results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Feb 2017 21:08:47 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-02-13T21:08:47Z</dc:date>
    <item>
      <title>deleting files using linux command</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/deleting-files-using-linux-command/m-p/332341#M22069</link>
      <description>&lt;P&gt;Hello friends,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i have below programs that i created to delete few selected&amp;nbsp;entire directories from specific dir (on linux system via EG).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this program running fine however, my goal is delete all&amp;nbsp;directories that i have in test2 dataset &amp;nbsp;(have like 15&amp;nbsp;dir under test) with "rm -rf" command but its just deleting one dir when i run it,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how can i tell SAS that perform all command (rm -rf) for all directory?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test (&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;keep&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=files);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;length&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; access $ &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;20&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; files $ &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;200&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;infile&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="3"&gt;"cd /test; ls -lt;"&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;pipe&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;firstobs&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; access $ nx $ user $ group $ size $ month $ day $ time $ files;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;/*creating rm -rf command*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test2;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;rmcmd=catx(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;' '&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'rm -rf'&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,cats(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'/test/'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,files);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;/*rmcmd variable looks like this*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;rmcmd&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;rm -rf sdfkjqfjnsvv&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New"&gt;rm -rf &lt;/FONT&gt;skdfjspiu&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New"&gt;rm -rf &lt;/FONT&gt;soivjasivuhqsvjnsvkjnsv&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New"&gt;rm -rf &lt;/FONT&gt;sdlvjasvhqqdsdkvjbqsdvhb&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;/*trying to execute rm -rf commanf for all*/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;_null_&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test2;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;infile&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; cmd &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;pipe&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;filevar&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=rmcmd;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;@;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Thanks a lot...!!!&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 20:56:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/deleting-files-using-linux-command/m-p/332341#M22069</guid>
      <dc:creator>woo</dc:creator>
      <dc:date>2017-02-13T20:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: deleting files using linux command</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/deleting-files-using-linux-command/m-p/332348#M22070</link>
      <description>&lt;P&gt;You might try the FDELETE function. You would not send the unix command just the name of the file and/or directory:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data _null_;
   set test2;
   rc=fdelete(fname);
   put rc=;
   msg=sysmsg();
   put msg=;
run;&lt;/PRE&gt;
&lt;P&gt;where Fname above is just the name of the directory. The PUT statements show the results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 21:08:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/deleting-files-using-linux-command/m-p/332348#M22070</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-13T21:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: deleting files using linux command</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/deleting-files-using-linux-command/m-p/332357#M22071</link>
      <description>dir name I have to remove is bigger than 8 char and that's why may be I am receiving this error, &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;NOTE: In a call to the FDELETE routine, the fileref rm -rf &lt;BR /&gt;      /test/sdfkjqfjnsvv exceeds 8 characters, and will be truncated.&lt;BR /&gt;rc=20004&lt;BR /&gt;msg=ERROR: No logical assign for filename RM.</description>
      <pubDate>Mon, 13 Feb 2017 21:21:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/deleting-files-using-linux-command/m-p/332357#M22071</guid>
      <dc:creator>woo</dc:creator>
      <dc:date>2017-02-13T21:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: deleting files using linux command</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/deleting-files-using-linux-command/m-p/332371#M22072</link>
      <description>&lt;P&gt;the length for any character type variable needs to be set long enough to hand the explected values. For the FDELETE you do not want the "rm -rf" as part of the name string as that is not the actual file or directory&amp;nbsp;name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another approach, would be the X or call system statements, IF you have permissions to run X. Since I'm not running on unix I can't really test what you may be attempting to provide more direct examples.&lt;/P&gt;
&lt;P&gt;Something like this perhaps:&lt;/P&gt;
&lt;PRE&gt;data _null_;
   set test2;
   call system(rmcmd);
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your pipe failing because INFILE is not really an executeable, as in it isnot called for each record in test2.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 21:52:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/deleting-files-using-linux-command/m-p/332371#M22072</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-13T21:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: deleting files using linux command</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/deleting-files-using-linux-command/m-p/332375#M22073</link>
      <description>&lt;P&gt;The easiest change is to use the FILEVAR option on the INFILE statement to execute the commands you have generated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test2;
  set test;
  rmcmd=catx(' ','rm -rf',cats('/test/',files));
run;

data _null_;
  set test2 ;
  infile cmd pipe filevar=rmcmd end=eof;
  do while (not eof);
    input;
    put _infile_;
  end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Feb 2017 22:00:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/deleting-files-using-linux-command/m-p/332375#M22073</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-02-13T22:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: deleting files using linux command</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/deleting-files-using-linux-command/m-p/332381#M22074</link>
      <description>tried same Tom &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;  - worked fine - thanks a lot...&lt;BR /&gt;&lt;BR /&gt;needed that end=eof + do while statement &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 13 Feb 2017 22:14:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/deleting-files-using-linux-command/m-p/332381#M22074</guid>
      <dc:creator>woo</dc:creator>
      <dc:date>2017-02-13T22:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: deleting files using linux command</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/deleting-files-using-linux-command/m-p/332404#M22078</link>
      <description>&lt;P&gt;Why not simply use call system to execute the rm commands?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set test2;
call system(rmcmd);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'd suggest to use absolute path names for the files to be removed.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 23:11:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/deleting-files-using-linux-command/m-p/332404#M22078</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-13T23:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: deleting files using linux command</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/deleting-files-using-linux-command/m-p/332467#M22082</link>
      <description>&lt;PRE&gt;

I would like to make a shell file to contain all these command, and execute once for all.

data _null_;
file '/home/temp.sh';
put "rm -rf sdfkjqfjnsvv";
put "rm -rf skdfjspiu";
put "rm -rf soivjasivuhqsvjnsvkjnsv";
put "rm -rf sdlvjasvhqqdsdkvjbqsdvhb";
run;

x "./home/temp.sh";


&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Feb 2017 03:36:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/deleting-files-using-linux-command/m-p/332467#M22082</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-02-14T03:36:50Z</dc:date>
    </item>
  </channel>
</rss>

