1

Konu: Klasör yardım

Benim yapmak istediğim örneğin bir diskim var.Buradaki c bölümündeki kaç tane klasör var nasıl bulabilirim acaba..

herkese yardımlarında dolayı teşekküler şimdiden.

2

Re: Klasör yardım

m.lnKlasorSayisi = ADir(laKlasorler, "C:\*.", "D")
Not: Yukarıdaki kodda klasör isminde "." varsa sorun olur

Ama aşağıdaki sayfadaki Çetin'in koduna baksan daha iyi edersin
http://www.fox4um.com/viewtopic.php?id=479

/o---------------------o\
     www.haser.com
\o---------------------o/

3

Re: Klasör yardım

adir() kullanabilirsin. Alt klasorleri de istiyorsan yapma derim (zaman almasi acisindan).
Ben Filer.dll'i tercih ediyorum:

Visual Fox Pro
1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
? GetTree('c:\Program Files')

SELECT CAST(filepath as c(250)) as filepath FROM folderlist
 
Function GetTree
  Lparameters tcStartDir
  Create Cursor folderlist (filepath m)
  oFiler = Createobject('filer.fileutil')
  With oFiler
    .SearchPath = m.tcStartDir
    .Subfolder = .T.
    .FileExpression = '.'
    .Find(0)
    For ix=1 To .Files.Count
      With .Files(ix)
        If Bittest(.Attr,4)
          Insert Into folderlist ;
            (filepath) values (.Path)
        Endif
      Endwith
    Endfor
    Return .Files.Count
  Endwith
Yen yaz 1907'ye yolla FB gelsin evinde yensin.
(sonra salaklar ciksin alin terine şike desin)

4

Re: Klasör yardım

Hocam çok saolun.Ellerinize sağlık.Çok işte yaradı..

5

Re: Klasör yardım

selamlar;
cetin hocam sayenizde CAST() ın select için de kullanımınıda öğrenmiş olduk. Ellerine sağlım.

Bilmediğin Neyse Yanıldığındır.

6

Re: Klasör yardım

çetin'e bu cast ın tam olarak ne olduğunu sormuştum ama sanırım güme gitti benim soru... sad

Haksızlıklar karşısında susanlar, dilsiz şeytanlardır!
www.metinemre.com

7

Re: Klasör yardım

http://www.fox4um.com/viewtopic.php?id=1074

Yen yaz 1907'ye yolla FB gelsin evinde yensin.
(sonra salaklar ciksin alin terine şike desin)

8

Re: Klasör yardım

Hocam, klasörlerle birlikte dosyaları da listeleyebilir miyiz. Topluca file isimlerinde ve klasörlerde rename yapabilmek için aşağıdaki kodda elde edilen klasörlerin yanı sıra dosya adlarını da elde etmemiz mümkün mü ?


cetinbasoz yazdı:

adir() kullanabilirsin. Alt klasorleri de istiyorsan yapma derim (zaman almasi acisindan).
Ben Filer.dll'i tercih ediyorum:

Visual Fox Pro
1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
? GetTree('c:\Program Files')

SELECT CAST(filepath as c(250)) as filepath FROM folderlist
 
Function GetTree
  Lparameters tcStartDir
  Create Cursor folderlist (filepath m)
  oFiler = Createobject('filer.fileutil')
  With oFiler
    .SearchPath = m.tcStartDir
    .Subfolder = .T.
    .FileExpression = '.'
    .Find(0)
    For ix=1 To .Files.Count
      With .Files(ix)
        If Bittest(.Attr,4)
          Insert Into folderlist ;
            (filepath) values (.Path)
        Endif
      Endwith
    Endfor
    Return .Files.Count
  Endwith

9

Re: Klasör yardım

Visual Fox Pro
1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
? GetTree('c:\Temp')

SELECT CAST(ADDBS(filepath)+filename as c(250)) as filepath FROM folderlist
 
Function GetTree
  Lparameters tcStartDir
  Create Cursor folderlist (filepath m, filename m)
  oFiler = Createobject('filer.fileutil')
  With oFiler
    .SearchPath = m.tcStartDir
    .Subfolder = .T.
    .FileExpression = '*.*'
    .Find(0)
    For ix=1 To .Files.Count
      With .Files(ix)
        *If Bittest(.Attr,4)
          Insert Into folderlist ;
            (filepath, filename) values (.Path, .Name)
        *Endif
      Endwith
    Endfor
    Return .Files.Count
  Endwith
Yen yaz 1907'ye yolla FB gelsin evinde yensin.
(sonra salaklar ciksin alin terine şike desin)

10

Re: Klasör yardım

Visual Fox Pro
1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
? GetTree(Home())

Select ;
  cast(filepath As Varchar(250)) As filepath, ;
  cast(filename As Varchar(250)) As filename, ;
  filesize, fattr, createtime, lastacc, lastwrite ;
  From filelist ;
  ORDER By 1,2
 
 
Function GetTree
  Lparameters tcStartDir
 
  Create Cursor filelist ;
    (filepath m, filename m, filesize i, ;
    fattr c(8), createtime T, lastacc T, lastwrite T)
 
  Create Cursor folderlist (filepath m)
  oFiler = Createobject('filer.fileutil')
  With oFiler
    .SearchPath = m.tcStartDir
    .Subfolder = 1
    .FileExpression = '*.*'
    .Find(0)
    For ix=1 To .Files.Count
      With .Files(ix)
 
        Insert Into filelist ;
          (filepath, filename, filesize, fattr, createtime, lastacc, lastwrite)  ;
          values ;
          (.Path, .Name, .Size, Attr2Char(.Attr), ;
          Num2Time2(.Datetime), Num2Time2(.LastAccessTime), Num2Time2(.LastWriteTime) )
 
      Endwith
    Endfor
    Return .Files.Count
  Endwith
Endfunc
 
Function Num2Time2
  Lparameters tnFloat
  Return Dtot(Date(1899,12,30) + m.tnFloat)
Endfunc
 
Function Attr2Char
  Lparameters tnAttr
  Return ;
    IIF(Bittest(tnAttr,0),'RO','RW')+;
    IIF(Bittest(tnAttr,1),'H','_')+;
    IIF(Bittest(tnAttr,2),'S','_')+;
    IIF(Bittest(tnAttr,4),'D','_')+;
    IIF(Bittest(tnAttr,5),'A','_')+;
    IIF(Bittest(tnAttr,6),'E','_')+;
    IIF(Bittest(tnAttr,7),'N','_')
Endfunc
Yen yaz 1907'ye yolla FB gelsin evinde yensin.
(sonra salaklar ciksin alin terine şike desin)

11

Re: Klasör yardım

Hocam harika oldu. Emeğine ve ellerine sağlık.