8.3 path and file list

Microsoft Windows
Post Reply
User avatar
MigrationUser
Posts: 336
Joined: 2021-Jul-12, 1:37 pm
Contact:

8.3 path and file list

Post by MigrationUser »

26 Aug 2008 20:49
drifty

Is it possible to create a file path and file name list that gives the short file and directory names? I have one that returns the long name and unicode characters but need the 8.3 names as well.

Code: Select all

CODE
set source_path=F:\Test_Set_1
set dest_path=G:\AB561\Logs\

cmd /u /c DIR /s /B /A:-D /O:-G %source_path% > %dest_path%\Dirlog.txt

Pause
----------------------------

#2 28 Aug 2008 18:32
Simon Sheppard


dir /x will give you the 8.3 filenames

----------------------------

#3 29 Aug 2008 19:02
drifty


Tried that but it still output the long file name into the log. Also tried it without the /u /c and the output was the same.
From the Log:
F:\Test_Set_1\Hidden\SSMSXLS10_4.xls
F:\Test_Set_1\Hidden\21p_1blank_2pnotes1&21_NO_comments_HF.ppt
F:\Test_Set_1\False\Visio Drawing-1_2002.fal
F:\Test_Set_1\False\SSMSXLS10_4.doc
F:\Test_Set_1\Encrypted\Visio Drawing-1_2002.vsd
F:\Test_Set_1\Encrypted\SSMSXLS10_4.xls
F:\Test_Set_1\Dates_11_17_2007\GRMSJPG1.02.jpg
F:\Test_Set_1\Dates_11_17_2007\CascadeKeywordSearchInfo.doc
F:\Test_Set_1\Data\2003_csv.csv
F:\Test_Set_1\Data\Addresses 1.txt
F:\Test_Set_1\Data\CascadeKeywordSearchInfo.doc
F:\Test_Set_1\Data\ecohandshake.gif
F:\Test_Set_1\Data\NSRLMfg.txt
F:\Test_Set_1\Data\NSRLProd.txt
F:\Test_Set_1\Data\그 먼 나라를 알으십니까.doc
F:\Test_Set_1\Data\地震_08057.doc
F:\Test_Set_1\Data\基礎文檔_06007.doc
F:\Test_Set_1\Data\教育局補助款表格.csv
F:\Test_Set_1\基礎文檔_FC\基礎文檔_06007.doc
----------------------------

#4 29 Aug 2008 19:23
drifty


Looks like the /B switch is the problem. If I remove it the log does contain the 8.3 name but it also has all the header and footer info. What I actually need is a simple list of the path and file name in 8.3.

----------------------------

#5 29 Aug 2008 19:30
Simon Sheppard


something like

Code: Select all

DIR /x | find "\"
----------------------------

#6 30 Aug 2008 10:29
bluesxman


How does this grab you, drifty?

Code: Select all

for /r F:\Test_Set_1 %%a in (*) do echo %%~sfa
cmd | *sh | ruby | chef

----------------------------

#7 02 Sep 2008 15:32
drifty


Perfect !
Thanks Very Much

----------------------------

#8 02 Sep 2008 19:41
drifty


Is there any way to get Robocopy to output a log in this format? Quite often I create a job file with some extentions to exclude then run Robocopy with the /L switch to create a log. I would like to parse this log and hash only the files in the list. Using Dir can get there but requires many more steps.

----------------------------

#9 03 Sep 2008 11:12
bluesxman


Don't think so. Best I could offer you is that you try dumping the log with robocopy, then working through that log with a "for" command (and possibly some other tomfoolery) to figure out the 8dot3 names.

cmd | *sh | ruby | chef

----------------------------

#10 03 Sep 2008 14:04
drifty


Kind of thought that so I was working on it last night. While I was working on it I switched machines from the Dell laptop that I was using to an older T40 (both with XP). When I tried the batch file the 8dot3 file names were not returned. Instead the long file names were placed in the log. I tried it again on both machines and got the same results. On the Dell the 8dot3 names are logged but on the T40 IBM they are not. Both have the same operating system and configured the same. Any idea why this would happen?
Examples:
Ran the batch file on a t60 laptop with XP (using two thumb drives):

CODE

Code: Select all

@echo off
cls

set source_path=F:\Test_Set_1
set log_path=G:\AB561\Logs\

::Create a Log File with a file list of 8 dot 3 path and file names

(
for /r %source_path% %%a in (*) do echo %%~sfa
) > %log_path%\Dirlog_83.txt

Pause
Log Entry:
F:\TEST_S~1\DATA\2003_csv.csv
F:\TEST_S~1\DATA\ADDRES~1.TXT
F:\TEST_S~1\DATA\CASCAD~1.DOC
F:\TEST_S~1\DATA\ECOHAN~1.GIF
Ran the same batch file on a T40 laptop with XP (thumb for destination and source on C:\):

CODE

Code: Select all

@echo off
cls

set source_path=C:\Test_Set_1
set log_path=E:\AB561\Logs\

::Create a Log File with a file list of 8 dot 3 path and file names

(
for /r %source_path% %%a in (*) do echo %%~sfa
) > %log_path%\Dirlog_83.txt

Pause
Log Entry:
C:\Test_Set_1\Data\2003_csv.csv
C:\Test_Set_1\Data\Addresses 1.txt
C:\Test_Set_1\Data\CascadeKeywordSearchInfo.doc
C:\Test_Set_1\Data\ecohandshake.gif
----------------------------

#11 03 Sep 2008 17:41
Simon Sheppard


Is it possible that one machine has 8.3 filename creation disabled?

Code: Select all

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]
NtfsDisable8dot3NameCreation

0
NTFS creates short file names.

1
NTFS does not create short file names.
----------------------------

#12 03 Sep 2008 22:15
bluesxman


Or you can use this command to check (XP/2K3):

Code: Select all

fsutil behavior query disable8dot3
EDIT: If it's a FAT file system (a bit unlikely I admit) check this out.

Last edited by bluesxman (03 Sep 2008 22:17)

cmd | *sh | ruby | chef

----------------------------

#13 04 Sep 2008 20:40
drifty


yes it is disabled.
Thanks
Post Reply