<?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 Convert Long filename to Short (Dos) filename in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-Long-filename-to-Short-Dos-filename/m-p/65281#M14175</link>
    <description>Does anyone have a macro utility or procedure that can convert the longform windows file names to the short form dos version?  For example, the path c:\program files becomes something like c:\progra~1.  Also this takes place at the file name level as well where "one two three four.xlsx" ends up something like onetwo~1.xls.&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
    <pubDate>Thu, 12 May 2011 13:22:00 GMT</pubDate>
    <dc:creator>wcpatton</dc:creator>
    <dc:date>2011-05-12T13:22:00Z</dc:date>
    <item>
      <title>Convert Long filename to Short (Dos) filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Long-filename-to-Short-Dos-filename/m-p/65281#M14175</link>
      <description>Does anyone have a macro utility or procedure that can convert the longform windows file names to the short form dos version?  For example, the path c:\program files becomes something like c:\progra~1.  Also this takes place at the file name level as well where "one two three four.xlsx" ends up something like onetwo~1.xls.&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
      <pubDate>Thu, 12 May 2011 13:22:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Long-filename-to-Short-Dos-filename/m-p/65281#M14175</guid>
      <dc:creator>wcpatton</dc:creator>
      <dc:date>2011-05-12T13:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Long filename to Short (Dos) filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Long-filename-to-Short-Dos-filename/m-p/65282#M14176</link>
      <description>I thought I had responded, but my post never showed up on the forum.&lt;BR /&gt;
&lt;BR /&gt;
You can always use a pipe to send and retrieve the results of a dir/x command.&lt;BR /&gt;
&lt;BR /&gt;
Art&lt;BR /&gt;
-----------&lt;BR /&gt;
 &amp;gt; Does anyone have a macro utility or procedure that&lt;BR /&gt;
&amp;gt; can convert the longform windows file names to the&lt;BR /&gt;
&amp;gt; short form dos version?  For example, the path&lt;BR /&gt;
&amp;gt; c:\program files becomes something like c:\progra~1.&lt;BR /&gt;
&amp;gt; Also this takes place at the file name level as well&lt;BR /&gt;
&amp;gt; where "one two three four.xlsx" ends up something&lt;BR /&gt;
&amp;gt;  like onetwo~1.xls.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Thanks.</description>
      <pubDate>Thu, 12 May 2011 23:15:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Long-filename-to-Short-Dos-filename/m-p/65282#M14176</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-05-12T23:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Long filename to Short (Dos) filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Long-filename-to-Short-Dos-filename/m-p/65283#M14177</link>
      <description>Try this....&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let Path = .\nPercenOfManyVars.sas;&lt;BR /&gt;
%let Path = ..;&lt;BR /&gt;
data ShortName(keep=Path Long: Short: Type);&lt;BR /&gt;
   attrib Path                length=$256;&lt;BR /&gt;
   attrib Type                length=$8;&lt;BR /&gt;
   attrib LongPathName        length=$256;&lt;BR /&gt;
   attrib ShortPathName       length=$256;&lt;BR /&gt;
   attrib LongFileName        length=$256;&lt;BR /&gt;
   attrib ShortFileName       length=$256;&lt;BR /&gt;
   length script filevar command $256;&lt;BR /&gt;
   Path     = symget('Path');&lt;BR /&gt;
   script   = catx('\',pathname('WORK'),'SHORTPATH.vbs');&lt;BR /&gt;
   filevar  = script;&lt;BR /&gt;
&lt;BR /&gt;
   /* Write the script */&lt;BR /&gt;
   file dummy1 filevar=script;&lt;BR /&gt;
   put Path=$quote258.;&lt;BR /&gt;
   infile cards eof=eof;&lt;BR /&gt;
   do while(1);&lt;BR /&gt;
      input;&lt;BR /&gt;
      put _infile_;&lt;BR /&gt;
      end;&lt;BR /&gt;
 eof:&lt;BR /&gt;
   /* close the script file by opening another, not used */&lt;BR /&gt;
   filevar = catx('\',pathname('WORK'),'DUMMY.vbs');&lt;BR /&gt;
   file dummy1 filevar=filevar;&lt;BR /&gt;
&lt;BR /&gt;
   /* look at the script useful for debuging, errors referenced by (row,column) as (13, 7)*/&lt;BR /&gt;
   infile dummy2 filevar=script end=eof;&lt;BR /&gt;
   file log ls=256;&lt;BR /&gt;
   put 'NOTE: ' Script=;&lt;BR /&gt;
   put 'RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0';&lt;BR /&gt;
   do _n_ = 1 by 1 while(not eof);&lt;BR /&gt;
      input;&lt;BR /&gt;
      putlog 'NOTE-' _n_ z4. @11 _infile_;&lt;BR /&gt;
      end;&lt;BR /&gt;
 &lt;BR /&gt;
   /* call the script */&lt;BR /&gt;
   command = catx(' ','cscript //nologo',quote(strip(script)));&lt;BR /&gt;
   infile dummy3 pipe filevar=command end=eof length=l lrecl=512;&lt;BR /&gt;
&lt;BR /&gt;
   put 'NOTE: Data lines returned from: ' command=;&lt;BR /&gt;
   put 'RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0';&lt;BR /&gt;
   do _n_ = 1 by 1 while(not eof);&lt;BR /&gt;
      input (_all_)(=);&lt;BR /&gt;
      putlog 'NOTE-' _n_ z4. @11 _infile_;&lt;BR /&gt;
      end;&lt;BR /&gt;
   _error_ = 0;&lt;BR /&gt;
   output;&lt;BR /&gt;
   stop;   &lt;BR /&gt;
   cards4;&lt;BR /&gt;
On Error Resume Next&lt;BR /&gt;
Set fso = CreateObject("Scripting.FileSystemObject")&lt;BR /&gt;
WScript.Echo "Path=" &amp;amp; path&lt;BR /&gt;
set f = fso.GetFile(Path)&lt;BR /&gt;
if err.number &amp;lt;&amp;gt; 0 then&lt;BR /&gt;
   err.number = 0&lt;BR /&gt;
   set f = fso.Getfolder(Path)&lt;BR /&gt;
   if err.number &amp;lt;&amp;gt; 0 then &lt;BR /&gt;
      WSCript.Echo "LongPathName=&lt;NOT found=""&gt;"&lt;BR /&gt;
   else &lt;BR /&gt;
      t = "Folder"&lt;BR /&gt;
      s = f.ShortPath&lt;BR /&gt;
      WScript.Echo "LongPathName=" &amp;amp; f &lt;BR /&gt;
      WScript.Echo "ShortPathName=" &amp;amp; s &lt;BR /&gt;
      Wscript.Echo "Type=" &amp;amp; t&lt;BR /&gt;
   end if&lt;BR /&gt;
else &lt;BR /&gt;
   s  = f.ShortPath&lt;BR /&gt;
   sn = f.ShortName&lt;BR /&gt;
   n  = f.Name&lt;BR /&gt;
   t  = "File"&lt;BR /&gt;
   WSCript.Echo "LongPathName=" &amp;amp;f&lt;BR /&gt;
   WSCript.Echo "ShortPathName=" &amp;amp;s&lt;BR /&gt;
   WSCript.Echo "LongFileName=" &amp;amp;n&lt;BR /&gt;
   WSCript.Echo "ShortFileName=" &amp;amp;sn&lt;BR /&gt;
   Wscript.Echo "Type=" &amp;amp; t&lt;BR /&gt;
&lt;BR /&gt;
end if   &lt;BR /&gt;
;;;;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc transpose out=ShortNames;&lt;BR /&gt;
   var _all_;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]&lt;/NOT&gt;</description>
      <pubDate>Sat, 14 May 2011 20:36:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Long-filename-to-Short-Dos-filename/m-p/65283#M14177</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-05-14T20:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Long filename to Short (Dos) filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Long-filename-to-Short-Dos-filename/m-p/65284#M14178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can ask windows kernel via modulen. Packaging it neatly into a user-written function (or a macro) is left as an exercise for the interested reader(s). &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 10pt;"&gt;/* cd to work */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; pwd = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;(pathname(work));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; pwd=&amp;amp;pwd;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;x&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; cd &amp;amp;pwd;&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 10pt;"&gt;/* create a test file with a long name */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; long = long file name.txt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;options&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;noxwait&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;x&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: Courier New; font-size: 10pt;"&gt;"copy nul ""&amp;amp;long"""&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 10pt;"&gt;/* create sascbtbl */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;filename&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; sascbtbl &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;catalog&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: Courier New; font-size: 10pt;"&gt;"work.winapi.fm.source"&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;file&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; sascbtbl; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;put&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;_infile_&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;cards4&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;routine GetShortPathNameA module=KERNEL32 minarg=3 maxarg=3 stackpop=called returns=long;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;arg 1 input char format=$cstr256.;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;arg 2 output char format=$cstr256.;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;arg 3 input num format=pib4.; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;;;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 10pt;"&gt;/* call the win32 api func via modulen */&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; long short $&lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;256&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; long = &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: Courier New; font-size: 10pt;"&gt;"&amp;amp;long"&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; || byte(&lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; short = byte(&lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; rc = modulen(&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: Courier New; font-size: 10pt;"&gt;"*e"&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: Courier New; font-size: 10pt;"&gt;"GetShortPathNameA"&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;, long, short, &lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; short = scan(short, &lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;, byte(&lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; rc=&lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;put&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: Courier New; font-size: 10pt;"&gt;"Uh-oh!"&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;put&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; (long short) (= :&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New; font-size: 10pt;"&gt;quote.&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;filename&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt; sascbtbl &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 10pt;"&gt;clear&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 10pt;"&gt;/* on log&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 10pt;"&gt;long="long file name.txt " short="LONGFI~1.TXT"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 10pt;"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 May 2011 18:42:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Long-filename-to-Short-Dos-filename/m-p/65284#M14178</guid>
      <dc:creator>chang_y_chung_hotmail_com</dc:creator>
      <dc:date>2011-05-16T18:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Long filename to Short (Dos) filename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Long-filename-to-Short-Dos-filename/m-p/65285#M14179</link>
      <description>Or If you like batch file.&lt;BR /&gt;
Assuming all the files are in c:\temp directory.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
filename fname pipe 'dir c:\temp\*.* /b';&lt;BR /&gt;
data _null_;&lt;BR /&gt;
 file 'c:\rename.bat';&lt;BR /&gt;
 infile fname length=len;&lt;BR /&gt;
 input name $varying100. len;&lt;BR /&gt;
 if (length(scan(name,1,'.')) gt &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; then do;&lt;BR /&gt;
 if findc(strip(name),' ') then do;&lt;BR /&gt;
 rename='rename '||strip(scan(name,1,' .'))||'*.'||strip(scan(name,-1,'.'))||&lt;BR /&gt;
 ' '||strip(substr(compress(name),1,6))||'~1.'||strip(scan(name,-1,'.'));&lt;BR /&gt;
 put rename;&lt;BR /&gt;
                         end;&lt;BR /&gt;
    else if findc(strip(name),'.') then do;&lt;BR /&gt;
         rename='rename '||strip(name)||' '||&lt;BR /&gt;
         strip(substr(compress(name),1,6))||'~1.'||strip(scan(name,-1,'.'));&lt;BR /&gt;
         put rename;&lt;BR /&gt;
         end;&lt;BR /&gt;
         else do;&lt;BR /&gt;
            rename='rename '||strip(name)||' '||strip(substr(compress(name),1,6))||'~1';&lt;BR /&gt;
         put rename;&lt;BR /&gt;
         end;&lt;BR /&gt;
              end;&lt;BR /&gt;
run;&lt;BR /&gt;
x "cd c:\temp\";&lt;BR /&gt;
x "c:\rename.bat";&lt;BR /&gt;
x "del c:\rename.bat";&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Wed, 18 May 2011 01:00:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Long-filename-to-Short-Dos-filename/m-p/65285#M14179</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-05-18T01:00:59Z</dc:date>
    </item>
  </channel>
</rss>

