Dear friends
The DIR command doesn't read refreshed real values of a folder.
If I have a very dynamic file that grows all the time, DIR gives any size, next DIR gives the same size until I go to the folder and press F5, then DIR gives a new bigger size.
Any ideas how to refresh from Command-Line?
Thanks
Yossi Moses
DIR command not Refreshed
Moderator: DosItHelp
Re: DIR command not Refreshed
I couldn't reproduce your result: The dir command is always updating:
Maybe buffering reduces the amount of single file update in your case.
penpen
Code: Select all
:: cmd.exe 1, same result even if replaced this dos cmd by an exe that grows extreme fast.
Z:\>for /L %a in (1,1,0x0FFFFF) do ((echo a) >> a.txt)
...
...
...
Code: Select all
:: cmd.exe 2
Z:\>for /L %a in (1,1,20) do dir a.txt
Z:\>dir a.txt
Volume in Laufwerk C: hat keine Bezeichnung.
Volumeseriennummer: F4EE-FCFD
Verzeichnis von Z:\
18.12.2013 20:37 2.835 a.txt
1 Datei(en), 2.835 Bytes
0 Verzeichnis(se), 9.785.974.784 Bytes frei
Z:\>dir a.txt
Volume in Laufwerk C: hat keine Bezeichnung.
Volumeseriennummer: F4EE-FCFD
Verzeichnis von Z:\
18.12.2013 20:37 2.838 a.txt
1 Datei(en), 2.838 Bytes
0 Verzeichnis(se), 9.785.974.784 Bytes frei
Z:\>dir a.txt
Volume in Laufwerk C: hat keine Bezeichnung.
Volumeseriennummer: F4EE-FCFD
18.12.2013 20:37 2.844 a.txt
1 Datei(en), 2.844 Bytes
0 Verzeichnis(se), 9.785.974.784 Bytes frei
...
...
...
Z:\>dir a.txt
Volume in Laufwerk C: hat keine Bezeichnung.
Volumeseriennummer: F4EE-FCFD
Verzeichnis von Z:\
18.12.2013 20:37 2.931 a.txt
1 Datei(en), 2.931 Bytes
0 Verzeichnis(se), 9.785.974.784 Bytes frei
Z:\>
penpen
Re: DIR command not Refreshed
In later versions of Windows when a file is being created then it may not show the increasing filesize like XP did.
-
- Posts: 3
- Joined: 14 Nov 2013 07:30
Re: DIR command not Refreshed
Thank you all
I tried it on XP and Win7, I ran in 2 separated command-line windows:
C:\>FOR /L %i IN (1, 1, 1000000) DO ECHO.X>> TEST.TXT
And
C:\NET>FOR /L %i IN (1, 1, 10000) DO DIR C:\TEST.TXT | FIND "TEST.TXT" >> DIR.TXT
And I got in Dir.TXT
12/19/2013 19:17 1,551 TEST.TXT
12/19/2013 19:17 1,563 TEST.TXT
12/19/2013 19:17 1,572 TEST.TXT
12/19/2013 19:17 1,590 TEST.TXT
12/19/2013 19:17 1,602 TEST.TXT
12/19/2013 19:17 1,614 TEST.TXT
And so on.
So, I don't know to create the situation, but in our servers the problem exists.
Thank you both very much
Yossi moses
I tried it on XP and Win7, I ran in 2 separated command-line windows:
C:\>FOR /L %i IN (1, 1, 1000000) DO ECHO.X>> TEST.TXT
And
C:\NET>FOR /L %i IN (1, 1, 10000) DO DIR C:\TEST.TXT | FIND "TEST.TXT" >> DIR.TXT
And I got in Dir.TXT
12/19/2013 19:17 1,551 TEST.TXT
12/19/2013 19:17 1,563 TEST.TXT
12/19/2013 19:17 1,572 TEST.TXT
12/19/2013 19:17 1,590 TEST.TXT
12/19/2013 19:17 1,602 TEST.TXT
12/19/2013 19:17 1,614 TEST.TXT
And so on.
So, I don't know to create the situation, but in our servers the problem exists.
Thank you both very much
Yossi moses
-
- Posts: 216
- Joined: 01 Oct 2012 13:32
- Location: Ireland
- Contact:
Re: DIR command not Refreshed
Hi Yossi,
Try the following:
A tip I picked up from ss64.com’s page on the type command.
Hope this helps!
- SB
Try the following:
Code: Select all
type dynamic-file.log >nul
dir dynamic-file.log
A tip I picked up from ss64.com’s page on the type command.
Hope this helps!
- SB
Re: DIR command not Refreshed
Only if Sponge Bellys suggestion does not solve your problem:
Maybe the problem could be solved by creating an c++ program, that checks the filesize by using the function GetFileSize.
If this function doesn't return the real value then i'm out of ideas, but
maybe the following list (that may be incomplete) helps you finding the issue,
although the given solutions may not be realizeable as it reduces the servers capabilities.
Possible causes -> and possible solutions:
- activated file cache -> disabled it (optimize for quick removal, or something like that)
- unsynchronized shared folder -> synchronize it (don't know the exe that does it),
- Volume Shadow Copy Service (VSS) -> disable it (may not be wanted by admin)
- raid side effect on faulty hardware, maybe possible, but i never have seen it -> (search for a defective hdd and replace it)
- mixed oses on server(s) / client(s) -> update server/client Software (SAMBA, ...)
penpen
Maybe the problem could be solved by creating an c++ program, that checks the filesize by using the function GetFileSize.
If this function doesn't return the real value then i'm out of ideas, but
maybe the following list (that may be incomplete) helps you finding the issue,
although the given solutions may not be realizeable as it reduces the servers capabilities.
Possible causes -> and possible solutions:
- activated file cache -> disabled it (optimize for quick removal, or something like that)
- unsynchronized shared folder -> synchronize it (don't know the exe that does it),
- Volume Shadow Copy Service (VSS) -> disable it (may not be wanted by admin)
- raid side effect on faulty hardware, maybe possible, but i never have seen it -> (search for a defective hdd and replace it)
- mixed oses on server(s) / client(s) -> update server/client Software (SAMBA, ...)
penpen