forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


@file(,D) bug in VDS 6 ?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Sat Mar 21, 2009 3:47 am    Post subject: @file(,D) bug in VDS 6 ? Reply with quote

I am sure that in VDS 5 I used to use the D flag with @file - i.e. @file(<drive-letter>:,D) - to check that a drive existed. Well, I actually used it to check that the specified directory exists, but it also previously worked for root directories (drives). But now with VDS 6 it returns null for all drives except the C:\ drive - @file(C:,D) returns C:_Default

The following code will list all existing drives, but only the C:\ drive is detected as a directory.
Code:
  list create,1
  %C = 67
  repeat
    %D = @chr(%C):
    %T = @volinfo(%D,T)
    if %T
      if @file(%D,D)
        list add,1,'%D\'  is a directory.  [%T drive]"     "
      else
        list add,1,'%D\'  is NOT a directory!  [%T drive]"     "
      end
    end
    %C = @succ(%C)
  until @greater(%C,90)
  info @text(1)
  stop


Is this a bug in VDS 6? (and the vdsrun50.dll included with VDS 6)
Or caused by XP Service Pack 3?
Or something particular to my Windows installation?

_________________
cheers

Dave


Last edited by DaveR on Sat Mar 21, 2009 4:02 am; edited 1 time in total
Back to top
View user's profile Send private message
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Sat Mar 21, 2009 4:00 am    Post subject: Reply with quote

The above question is more out of curiosity than need for a solution. I have created a function to check if a drive or directory exists, and determine which it is.

Code:
:Dir
  #------------------------------------------------
  # Function to check if Directory or Drive exists
  #   Syntax: if @Dir(<folderpath>)
  #------------------------------------------------
  if @trim(%1)
    %s = %1
    while @equal(@substr(%s,@len(%s)),"\")
      %s = @substr(%s,1,-1)
    wend
    if @file(%s,D)
      if @greater(@len(%s),2)
        %x = directory
      else
        %x = drive
      end
    elsif @volinfo(%1,T)
      if @equal(@len(%s),2)
        if @equal(:,@substr(%s,2))
          %x = drive
        end
      elsif @equal(@len(%s),1)
        %x = drive
      end
    end
  end
  exit %x

_________________
cheers

Dave
Back to top
View user's profile Send private message
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Sun Mar 22, 2009 3:12 am    Post subject: Reply with quote

It gets even better.

Save your script to somewhere that isn't on drive C:\ and when you run it none of the drives are considered directories including C: Insane

BTW - I ran this on XP SP3 and Vista SP1 using VDS6, 5.1, and 5 (origonal)

This begs the question, maybe the bug is actually that it considers C: a directory. C: is actually a partition in which you put a directory on.

Try this and you might see what I mean
Code:
list create,1
  %C = 67
  repeat
    %D = @chr(%C):
    %T = @volinfo(%D,T)
    if %T
     info @file(%D,DY)
      if @file(%D,D)
        list add,1,'%D'  is a directory.  [%T drive]"     "
      else
        list add,1,'%D'  is NOT a directory!  [%T drive]"     "
      end
    end
    %C = @succ(%C)
  until @greater(%C,90)
  info @text(1)
  stop
Back to top
View user's profile Send private message Send e-mail
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Sun Mar 22, 2009 3:57 am    Post subject: Reply with quote

In the same respect you can't do this either
Code:
%C = 67
  repeat
    %D = @chr(%C):
    Directory create,%D
   %C = @succ(%C)
  until @greater(%C,90)
stop
Back to top
View user's profile Send private message Send e-mail
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Sat Mar 28, 2009 2:40 am    Post subject: Reply with quote

Aslan wrote:
maybe the bug is actually that it considers C: a directory.

I think you're right.

_________________
cheers

Dave
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Thu May 21, 2009 7:55 pm    Post subject: Reply with quote

The help file is not helpful with this topic either as it says you need to use @file(,Y) and it will return a string with the following

Code:
Y  returns a string of flags representing the file attributes, these are:
  R
    read-only
  H
    hidden
  S
    system
  D
    directory
  A
    archive
  N
    normal
  T
    temporary
  C
    compressed
  O
    offline


But yet, when I use Y on a directory, I get nothing at all. But! if I use @file(,D) with a directory as the item in question, I get it's path returned to me as the result. If i put a file as the item instead of a valid directory, I again get nothing returned as a result.

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
geicsge
Newbie


Joined: 27 Feb 2009
Posts: 19

PostPosted: Sat Oct 31, 2009 10:58 am    Post subject: Reply with quote

I had a lot of errors working with files/folders in the past. So, when I want to check if exists/move/rename/DELETE a folder, my solution always is:

Code:

runh @chr(34)@path(%0)bin\cmd.exe@chr(34) /C attrib.exe /S /D -R -S -H @chr(34)%%WD\*.*@chr(34),WAIT


where %%WD is for example your windows folder C:\WINDOWS

(I have my own CMD.EXE and ATTRIB.EXE in @path(%0)\bin folder. Just because I had few times damaged installations where a lot of windows executables doesn't launch anymore, for many reasons)

Of course, you can tell me many things regarding this, BUT, this is the only solution I have. I must DELETE for example C:\System Volume Information, and to to this, first I reset the folder rights using SUBINACL.EXE

Code:

%a =%%SV":\System Volume Information"
runh @chr(34)@path(%0)bin\subinacl.exe@chr(34) /noverbose /nostatistic /subdirectories @chr(34)%a@chr(34) /grant=administrators=f /grant=system=f /grant=@chr(34)CREATOR OWNER@chr(34)=f /grant=Users=f,WAIT

and second I use
Code:

runh @chr(34)@path(%0)bin\cmd.exe@chr(34) /C attrib.exe /S /D -R -S -H @chr(34)%a@chr(34),WAIT

to be sure the folder will be deleted.

My conclusion was and still is VDS doesn't always catch if a folder/file exists or not, that depends its condition (long path, attributes, compressed or not, encrypted or not, access rights etc)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Bug Reports All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group