{"id":17,"date":"2007-07-04T13:10:00","date_gmt":"2007-07-04T18:10:00","guid":{"rendered":"synetech.ddns.net\/blogs\/smarticles\/blog\/2007\/07\/04\/computers-os-unexpected-dir-results-for-numbered-files\/"},"modified":"2011-03-03T18:11:44","modified_gmt":"2011-03-03T23:11:44","slug":"unexpected-dir-results-for-numbered-files","status":"publish","type":"post","link":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/2007\/07\/04\/unexpected-dir-results-for-numbered-files\/","title":{"rendered":"Unexpected DIR Results for Numbered Files"},"content":{"rendered":"<p>If you have ever used the DIR command to list numbered files in a command prompt and been confused by the output, it may have been due to <acronym title=\"short file names\">SFNs<\/acronym>.<\/p>\n<p>Here is an example to demonstrate the problem.  In a directory with files with long names and numbered filenames, you might type <code>dir *1.txt<\/code> to list all files that end in a 1.  However you may end up getting a bunch of files that do not end in a 1 mixed in with the results.<\/p>\n<p>What happened?  Remember that each file that has a long filename has a DOS compatible (8.3) SFN associated with it.  These are usually six characters from the filename followed by a swung-dash and a numerical counter.  In other words, \u201cLong Filename.txt\u201d would not only have that as it\u2019s name, but also \u201cLONGFI~1.TXT\u201d.  And <strong>there\u2019s<\/strong> the <strong>1<\/strong>!<\/p>\n<p>If there are multiple LFN files (that are too long or have spaces) that begin with <em>LONGFI<\/em>\u2014eg \u201cLong File.txt\u201d, \u201cLong Fi.txt\u201d, etc.\u2014then they will be saved as LONGFI~2.txt, LONGFI~3.txt, and so on.  Therefore you may get weird results for <code>dir *2.txt<\/code>, <code>dir *8.txt<\/code>, <code>dir *516.txt<\/code>\u2026<\/p>\n<p>There does not seem to be a way around this, but using the \/X switch can at least reveal the source of the unexpected results.<\/p>\n<div class=\"tagcloud\"><a href=\"https:\/\/synetech.ddns.net\/blogs\/smarticles\/tag\/command-prompt\/\" rel=\"tag\">Command Prompt<\/a>, <a href=\"https:\/\/synetech.ddns.net\/blogs\/smarticles\/tag\/computers\/\" rel=\"tag\">Computers<\/a>, <a href=\"https:\/\/synetech.ddns.net\/blogs\/smarticles\/tag\/operating-systems\/\" rel=\"tag\">Operating Systems<\/a><\/div>","protected":false},"excerpt":{"rendered":"<p>If you have ever used the DIR command to list numbered files in a command prompt and been confused by the output, it may have been due to SFNs. Here is an example to demonstrate the problem. In a directory with files with long names and numbered filenames, you might type dir *1.txt to list [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[33,14,9],"class_list":["post-17","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-command-prompt","tag-computers","tag-operating-systems"],"_links":{"self":[{"href":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/wp-json\/wp\/v2\/posts\/17","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/wp-json\/wp\/v2\/comments?post=17"}],"version-history":[{"count":0,"href":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/wp-json\/wp\/v2\/posts\/17\/revisions"}],"wp:attachment":[{"href":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/wp-json\/wp\/v2\/media?parent=17"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/wp-json\/wp\/v2\/categories?post=17"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/synetech.ddns.net\/blogs\/smarticles\/wp-json\/wp\/v2\/tags?post=17"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}