<?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 Delete All files with a specific extension in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Delete-All-files-with-a-specific-extension/m-p/887448#M350604</link>
    <description>&lt;P&gt;Each month I create roughly 200 Excel files, 100 files are the old school "XLS" Excel files, then those files are turned into new "XLSX" files.&lt;/P&gt;
&lt;P&gt;So there are two files with identical names, but with different extensions.&amp;nbsp; I want to delete all of the "XLS" files but not the "XLSX" files.&amp;nbsp; &amp;nbsp;Each month the file names are different.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Aug 2023 08:39:20 GMT</pubDate>
    <dc:creator>texasmfp</dc:creator>
    <dc:date>2023-08-02T08:39:20Z</dc:date>
    <item>
      <title>Delete All files with a specific extension</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-All-files-with-a-specific-extension/m-p/887448#M350604</link>
      <description>&lt;P&gt;Each month I create roughly 200 Excel files, 100 files are the old school "XLS" Excel files, then those files are turned into new "XLSX" files.&lt;/P&gt;
&lt;P&gt;So there are two files with identical names, but with different extensions.&amp;nbsp; I want to delete all of the "XLS" files but not the "XLSX" files.&amp;nbsp; &amp;nbsp;Each month the file names are different.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 08:39:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-All-files-with-a-specific-extension/m-p/887448#M350604</guid>
      <dc:creator>texasmfp</dc:creator>
      <dc:date>2023-08-02T08:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: Delete All files with a specific extension</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-All-files-with-a-specific-extension/m-p/887453#M350609</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;if you do not need to double check if the *.xlsx exists before deleting the *.xls you could simply use the x command:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x "del ""YourPath\*.xls""";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Aug 2023 09:19:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-All-files-with-a-specific-extension/m-p/887453#M350609</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2023-08-02T09:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Delete All files with a specific extension</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-All-files-with-a-specific-extension/m-p/887458#M350611</link>
      <description>&lt;P&gt;That works with some modifications to my program.&amp;nbsp; Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 12:00:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-All-files-with-a-specific-extension/m-p/887458#M350611</guid>
      <dc:creator>texasmfp</dc:creator>
      <dc:date>2023-08-02T12:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: Delete All files with a specific extension</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-All-files-with-a-specific-extension/m-p/887472#M350621</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path= c:\temp\a  ;


data _null_;
rc=filename('x',"&amp;amp;path.");
did=dopen('x');
do i=1 to dnum(did);
  fname=dread(did,i);
  if upcase(scan(fname,-1,'.'))='XLS' then do;
    rc=filename('y',cats("&amp;amp;path.\",fname));
	rc=fdelete('y');
  end;
end;
did=dclose(did);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Aug 2023 11:56:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-All-files-with-a-specific-extension/m-p/887472#M350621</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-08-02T11:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: Delete All files with a specific extension</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-All-files-with-a-specific-extension/m-p/887473#M350622</link>
      <description>&lt;P&gt;Thanks, that works as well&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 11:59:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-All-files-with-a-specific-extension/m-p/887473#M350622</guid>
      <dc:creator>texasmfp</dc:creator>
      <dc:date>2023-08-02T11:59:49Z</dc:date>
    </item>
  </channel>
</rss>

