GNU/Linux Dağıtımlarında Sık Kullandığım Komutlar
- TRWE_2012
- Mesaj Panosu Yöneticisi
- Mesajlar: 904
- Kayıt: 30 Ağu 2022 21:59
- Konum: DÜZCE/Akçakoca
- Meslek: MADEN MÜHENDİSİ
- Teşekkür etti: 254 kez
- Teşekkür edildi: 754 kez
- İletişim:
GNU/Linux Dağıtımlarında Sık Kullandığım Komutlar
Bu forum konusunda, hemen hemen her temiz kurulumun ardından, GNU/Linux Mint dağıtımında kullanmayı alışkanlık haline getirdiğim bazı GNU/Unix komutları var.
Bu komutları kullanımlarını bir not haline getirmek için açtığım forum konusudur.
Her bir alt forum mesajı bir komut ve bu komutun kullanım notu olacak şekilde yapılandırılacaktır.
Hadi başlayalım...


Etiketler:
- TRWE_2012
- Mesaj Panosu Yöneticisi
- Mesajlar: 904
- Kayıt: 30 Ağu 2022 21:59
- Konum: DÜZCE/Akçakoca
- Meslek: MADEN MÜHENDİSİ
- Teşekkür etti: 254 kez
- Teşekkür edildi: 754 kez
- İletişim:
TREE Komutu : sudo apt-get -u install tree
Kod: Tümünü seç
------------------------------------------------------
TREE(1) General Commands Manual TREE(1)
NAME
tree - list contents of directories in a tree-like format.
SYNOPSIS
tree [-acdfghilnpqrstuvxACDFJQNSUX] [-L level [-R]] [-H baseHREF] [-T title] [-o filename] [-P pattern] [-I pattern]
[--gitignore] [--matchdirs] [--metafirst] [--ignore-case] [--nolinks] [--inodes] [--device] [--sort[=]name] [--dirsfirst]
[--filesfirst] [--filelimit #] [--si] [--du] [--prune] [--timefmt[=]format] [--fromfile] [--info] [--noreport] [--version]
[--help] [--] [directory ...]
DESCRIPTION
Tree is a recursive directory listing program that produces a depth indented listing of files, which is colorized ala dir‐
colors if the LS_COLORS environment variable is set and output is to tty. With no arguments, tree lists the files in the
current directory. When directory arguments are given, tree lists all the files and/or directories found in the given di‐
rectories each in turn. Upon completion of listing all files/directories found, tree returns the total number of files
and/or directories listed.
By default, when a symbolic link is encountered, the path that the symbolic link refers to is printed after the name of the
link in the format:
name -> real-path
If the `-l' option is given and the symbolic link refers to an actual directory, then tree will follow the path of the sym‐
bolic link as if it were a real directory.
OPTIONS
Tree understands the following command line switches:
LISTING OPTIONS
-a All files are printed. By default tree does not print hidden files (those beginning with a dot `.'). In no event
does tree print the file system constructs `.' (current directory) and `..' (previous directory).
-d List directories only.
-l Follows symbolic links if they point to directories, as if they were directories. Symbolic links that will result in
recursion are avoided when detected.
-f Prints the full path prefix for each file.
-x Stay on the current file-system only. Ala find -xdev.
-L level
Max display depth of the directory tree.
-R Recursively cross down the tree each level directories (see -L option), and at each of them execute tree again
adding `-o 00Tree.html' as a new option.
-P pattern
List only those files that match the wild-card pattern. You may have multiple -P options. Note: you must use the -a
option to also consider those files beginning with a dot `.' for matching. Valid wildcard operators are `*' (any
zero or more characters), `**` (any zero or more characters as well as null /'s, i.e. /**/ may match a single /),
`?' (any single character), `[...]' (any single character listed between brackets (optional - (dash) for character
range may be used: ex: [A-Z]), and `[^...]' (any single character not listed in brackets) and `|' separates alter‐
nate patterns. A '/' at the end of the pattern matches directories, but not files.
-I pattern
Do not list those files that match the wild-card pattern. You may have multiple -I options. See -P above for in‐
formation on wildcard patterns.
--gitignore
Uses git .gitignore files for filtering files and directories. Also uses $GIT_DIR/info/exclude if present.
--ignore-case
If a match pattern is specified by the -P or -I option, this will cause the pattern to match without regards to the
case of each letter.
--matchdirs
If a match pattern is specified by the -P option, this will cause the pattern to be applied to directory names (in
addition to filenames). In the event of a match on the directory name, matching is disabled for the directory's
contents. If the --prune option is used, empty folders that match the pattern will not be pruned.
--metafirst
Print the meta-data information at the beginning of the line rather than after the indentation lines.
--prune
Makes tree prune empty directories from the output, useful when used in conjunction with -P or -I. See BUGS AND
NOTES below for more information on this option.
--info Prints file comments found in .info files. See .INFO FILES below for more information on the format of .info files.
--noreport
Omits printing of the file and directory report at the end of the tree listing.
--charset charset
Set the character set to use when outputting HTML and for line drawing.
--filelimit #
Do not descend directories that contain more than # entries.
--timefmt format
Prints (implies -D) and formats the date according to the format string which uses the strftime(3) syntax.
-o filename
Send output to filename.
FILE OPTIONS
-q Print non-printable characters in filenames as question marks instead of the default.
-N Print non-printable characters as is instead of as escaped octal numbers.
-Q Quote the names of files in double quotes.
-p Print the file type and permissions for each file (as per ls -l).
-u Print the username, or UID # if no username is available, of the file.
-g Print the group name, or GID # if no group name is available, of the file.
-s Print the size of each file in bytes along with the name.
-h Print the size of each file but in a more human readable way, e.g. appending a size letter for kilobytes (K),
megabytes (M), gigabytes (G), terabytes (T), petabytes (P) and exabytes (E).
--si Like -h but use SI units (powers of 1000) instead.
--du For each directory report its size as the accumulation of sizes of all its files and sub-directories (and their
files, and so on). The total amount of used space is also given in the final report (like the 'du -c' command.)
This option requires tree to read the entire directory tree before emitting it, see BUGS AND NOTES below. Implies
-s.
-D Print the date of the last modification time or if -c is used, the last status change time for the file listed.
-F Append a `/' for directories, a `=' for socket files, a `*' for executable files, a `>' for doors (Solaris) and a
`|' for FIFO's, as per ls -F
--inodes
Prints the inode number of the file or directory
--device
Prints the device number to which the file or directory belongs
SORTING OPTIONS
-v Sort the output by version.
-t Sort the output by last modification time instead of alphabetically.
-c Sort the output by last status change instead of alphabetically. Modifies the -D option (if used) to print the last
status change instead of modification time.
-U Do not sort. Lists files in directory order. Disables --dirsfirst.
-r Sort the output in reverse order. This is a meta-sort that alter the above sorts. This option is disabled when -U
is used.
--dirsfirst
List directories before files. This is a meta-sort that alters the above sorts. This option is disabled when -U is
used.
--filesfirst
List files before directories. This is a meta-sort that alters the above sorts. This option is disabled when -U is
used.
--sort[=]type
Sort the output by type instead of name. Possible values are: ctime (-c), mtime (-t), size, or version (-v).
GRAPHICS OPTIONS
-i Makes tree not print the indentation lines, useful when used in conjunction with the -f option. Also removes as
much whitespace as possible when used with the -J or -x options.
-A Turn on ANSI line graphics hack when printing the indentation lines.
-S Turn on CP437 line graphics (useful when using Linux console mode fonts). This option is now equivalent to
`--charset=IBM437' and may eventually be depreciated.
-n Turn colorization off always, over-ridden by the -C option, however overrides CLICOLOR_FORCE if present.
-C Turn colorization on always, using built-in color defaults if the LS_COLORS or TREE_COLORS environment variables are
not set. Useful to colorize output to a pipe.
XML/JSON/HTML OPTIONS
-X Turn on XML output. Outputs the directory tree as an XML formatted file.
-J Turn on JSON output. Outputs the directory tree as a JSON formatted array.
-H baseHREF
Turn on HTML output, including HTTP references. Useful for ftp sites. baseHREF gives the base ftp location when us‐
ing HTML output. That is, the local directory may be `/local/ftp/pub', but it must be referenced as `ftp://host‐
name.organization.domain/pub' (baseHREF should be `ftp://hostname.organization.domain'). Hint: don't use ANSI lines
with this option, and don't give more than one directory in the directory list. If you wish to use colors via CSS
style-sheet, use the -C option in addition to this option to force color output.
-T title
Sets the title and H1 header string in HTML output mode.
--nolinks
Turns off hyperlinks in HTML output.
INPUT OPTIONS
--fromfile Reads a directory listing from a file rather than the file-system. Paths provided on the command line are files
to read from rather than directories to search. The dot (.) directory indicates that tree should read paths from standard
input. NOTE: this is only suitable for reading the output of a program such as find, not 'tree -fi' as symlinks cannot (at
least as yet) be distinguished from files that simply contain ' -> ' as part of the filename.
MISC OPTIONS
--help Outputs a verbose usage listing.
--version
Outputs the version of tree.
-- Option processing terminator. No further options will be processed after this.
.INFO FILES
.info files are similiar to .gitignore files, if a .info file is found while scanning a directory it is read and added to a
stack of .info information. Each file is composed of comments (lines starting with hash marks (#),) or wild-card patterns
which may match a file relative to the directory the .info file is found in. If a file should match a pattern, the tab in‐
dented comment that follows the pattern is used as the file comment. A comment is terminated by a non-tab indented line.
Multiple patterns, each to a line, may share the same comment.
FILES
/etc/DIR_COLORS System color database.
~/.dircolors Users color database.
.gitignore Git exclusion file
$GIT_DIR/info/exclude Global git file exclusion list
.info File comment file
/usr/share/finfo/global_info Global file comment file
ENVIRONMENT
LS_COLORS Color information created by dircolors
TREE_COLORS Uses this for color information over LS_COLORS if it is set.
TREE_CHARSET Character set for tree to use in HTML mode.
CLICOLOR Enables colorization even if TREE_COLORS or LS_COLORS is not set.
CLICOLOR_FORCE Always enables colorization (effectively -C)
LC_CTYPE Locale for filename output.
LC_TIME Locale for timefmt output, see strftime(3).
TZ Timezone for timefmt output, see strftime(3).
STDDATA_FD Enable the stddata feature, optionally set descriptor to use.
AUTHOR
Steve Baker (ice@mama.indstate.edu)
HTML output hacked by Francesc Rocher (rocher@econ.udg.es)
Charsets and OS/2 support by Kyosuke Tokoro (NBG01720@nifty.ne.jp)
BUGS AND NOTES
Tree does not prune "empty" directories when the -P and -I options are used by default. Use the --prune option.
The -h and --si options round to the nearest whole number unlike the ls implementations which rounds up always.
Pruning files and directories with the -I, -P and --filelimit options will lead to incorrect file/directory count reports.
The --prune and --du options cause tree to accumulate the entire tree in memory before emitting it. For large directory
trees this can cause a significant delay in output and the use of large amounts of memory.
The timefmt expansion buffer is limited to a ridiculously large 255 characters. Output of time strings longer than this
will be undefined, but are guaranteed to not exceed 255 characters.
XML/JSON trees are not colored, which is a bit of a shame.
Probably more.
As of version 2.0.0, in Linux, tree will attempt to automatically output a compact JSON tree on file descriptor 3 (what I
call stddata,) if present and the environment variable STDDATA_FD is defined or set to a positive non-zero file descriptor
value to use to output on. It is hoped that some day a better Linux/Unix shell may take advantage of this feature, though
BSON would probably be a better format for this.
SEE ALSO
dircolors(1), ls(1), find(1), du(1), strftime(3) gitignore(5)
Tree 2.0.0 TREE(1)
------------------------------------------------------
TREE(1) - Genel Komutlar Kılavuzu
İSİM
tree - Dizinlerin içeriğini ağaç şeklinde listeleyen komut.
KULLANIM
Kod: Tümünü seç
tree [-acdfghilnpqrstuvxACDFJQNSUX] [-L seviye [-R]] [-H baseHREF] [-T baslik] [-o dosya_adi] [-P desen] [-I desen] [--gitignore] [--matchdirs] [--metafirst] [--ignore-case] [--nolinks] [--inodes] [--device] [--sort[=]isim] [--dirsfirst] [--filesfirst] [--filelimit #] [--si] [--du] [--prune] [--timefmt[=]format] [--fromfile] [--info] [--noreport] [--version] [--help] [--] [dizin ...]
tree komutu, dizinleri ve içerdikleri dosyaları ağaç şeklinde görüntüleyen, özyinelemeli (recursive) bir komuttur. Eğer herhangi bir argüman verilmezse, mevcut dizindeki dosyaları listeler. Bir veya birden fazla dizin belirtilirse, o dizinlerdeki tüm dosya ve dizinleri sırasıyla listeler. Çıktının sonunda toplam dosya ve dizin sayısını gösterir.
Varsayılan olarak, tree bir sembolik bağlantıya rastladığında bağlantının işaret ettiği yolu da şu formatta gösterir:
Kod: Tümünü seç
isim -> gerçek-yol
SEÇENEKLER
LİSTELEME SEÇENEKLERİ
-a : Gizli dosyalar dahil tüm dosyaları listeler. Varsayılan olarak, tree nokta (.) ile başlayan gizli dosyaları listelemez.
-d : Yalnızca dizinleri listeler.
-l : Sembolik bağlantılar dizini gösteriyorsa, onları takip eder.
-f : Her dosyanın tam yolunu gösterir.
-x : Yalnızca mevcut dosya sisteminde kalır, başka bir bağlı dosya sistemine geçmez.
-L seviye : Ağaç görüntüsünün maksimum derinliğini belirler.
-P desen : Belirtilen desenle eşleşen dosyaları gösterir (joker karakterler kullanılabilir: *, ?, [abc], vb.).
-I desen : Belirtilen desenle eşleşen dosyaları hariç tutar.
--gitignore : .gitignore dosyasına göre dosya ve dizinleri filtreler.
--prune : Boş dizinleri listeden kaldırır.
DOSYA BİLGİLERİ SEÇENEKLERİ
-p : Dosya izinlerini gösterir (ls -l formatında).
-u : Dosyanın sahibini gösterir.
-g : Dosyanın grup bilgisini gösterir.
-s : Dosya boyutunu bayt cinsinden gösterir.
-h : Dosya boyutunu okunabilir biçimde gösterir (örneğin, 1.2M gibi).
-D : Dosyanın son değişiklik tarihini gösterir.
SIRALAMA SEÇENEKLERİ
-v : Sürüm numaralarına göre sıralar.
-t : Dosyaları son değişiklik zamanına göre sıralar.
-r : Sıralamayı tersine çevirir.
--dirsfirst : Önce dizinleri, sonra dosyaları listeler.
GÖRSEL SEÇENEKLER
-i : Girinti çizgilerini kaldırır.
-A : ANSI çizgi grafiklerini kullanır.
-n : Renkli çıktıyı devre dışı bırakır.
-C : Renkli çıktıyı etkinleştirir.
XML / JSON / HTML ÇIKTI SEÇENEKLERİ
-X : XML formatında çıktı üretir.
-J : JSON formatında çıktı üretir.
-H baseHREF : HTML formatında çıktı üretir.
-T title : HTML çıktısı için başlık belirler.
DİĞER SEÇENEKLER
--help : Yardım metnini görüntüler.
--version : tree komutunun sürüm bilgisini gösterir.
ÖRNEK KULLANIMLAR
Mevcut dizindeki dosyaları ağaç şeklinde listeleme:
Kod: Tümünü seç
tree
Kod: Tümünü seç
tree -a
Kod: Tümünü seç
tree -d
Kod: Tümünü seç
tree /home/kullanici
Kod: Tümünü seç
tree -L 2
Kod: Tümünü seç
tree -pugsh
Kod: Tümünü seç
tree -t
Kod: Tümünü seç
tree -P "*.txt"
Kod: Tümünü seç
tree --gitignore
Kod: Tümünü seç
tree -H /home/kullanici -o output.html
LS_COLORS : Renk bilgisini belirler.
TREE_COLORS : LS_COLORS yerine renk bilgisi sağlar.
CLICOLOR : Renkli çıktıyı zorla etkinleştirir.
LC_CTYPE : Dosya adı çıktısı için dil ayarlarını belirler.
LC_TIME : Tarih ve saat biçimini belirler.
YAZARLAR
Steve Baker (ice@mama.indstate.edu)
Francesc Rocher (rocher@econ.udg.es) - HTML desteği ekledi.
Kyosuke Tokoro - Karakter setleri ve OS/2 desteği ekledi.
Bu çeviri tree komutunun man sayfasını Türkçeye kazandırmak amacıyla yapılmıştır. Kullanımınıza uygun olarak özelleştirilebilir.
Benim en çok sık kullandığım komut dizgesi (düzeni) :
Kod: Tümünü seç
tree -a -L 3 -h -p -u -g -D {Dizinin Tam Yolu}
Kod: Tümünü seç
tree -a -L 3 -h -p -u -g -D {Hedef Dosyanın Tam Yolu}
ÖRNEKSEL GENEL GÖSTERİM:
Kod: Tümünü seç
tree -a -L 3 -h -p -u -g -D /home/kullanıcı_hesap_adı
- Gizli dosyalar dahil,
- Maksimum 3 seviye derinlikte,
- Dosya boyutlarını okunabilir formatta,
- Dosya izinlerini,
- Sahip ve grup bilgilerini,
- Son değişiklik tarihlerini
KOMUT ÇIKTISI :
Kod: Tümünü seç
/home/kullanıcı_hesap_adı
├── [-rw-r--r--] [user group] [2025-03-06 14:30] .bashrc
├── [-rw-r--r--] [user group] [2025-02-15 10:12] .profile
├── [-rw-r--r--] [user group] [2025-01-30 08:05] .vimrc
├── [drwxr-xr-x] [user group] [2025-03-05 20:45] Documents
│ ├── [-rw-r--r--] [user group] [2025-03-02 18:30] notes.txt
│ ├── [-rw-r--r--] [user group] [2025-03-01 21:15] todo.txt
│ └── [drwxr-xr-x] [user group] [2025-02-28 15:00] Projects
│ ├── [-rw-r--r--] [user group] [2025-02-27 12:50] project1.docx
│ ├── [-rw-r--r--] [user group] [2025-02-26 09:20] project2.pdf
│ └── [-rw-r--r--] [user group] [2025-02-25 14:30] readme.md
├── [drwxr-xr-x] [user group] [2025-03-04 13:10] Downloads
│ ├── [-rw-r--r--] [user group] [2025-03-03 16:40] setup.sh
│ ├── [-rw-r--r--] [user group] [2025-03-02 11:20] archive.zip
│ └── [-rw-r--r--] [user group] [2025-02-28 08:00] wallpaper.jpg
└── [drwxr-xr-x] [user group] [2025-03-06 12:00] Pictures
├── [-rw-r--r--] [user group] [2025-03-05 22:10] photo1.png
├── [-rw-r--r--] [user group] [2025-03-05 19:05] photo2.jpg
└── [-rw-r--r--] [user group] [2025-03-04 15:30] screenshot.png
3 directories, 10 files
- [ -rw-r--r-- ] → Dosya/dizin izinleri
- [ user group ] → Sahip olan kullanıcı ve grup
- [ 2025-03-06 14:30 ] → Son değişiklik tarihi ve saati
- Documents, Downloads, Pictures → Dizinler (klasörler)
- notes.txt, todo.txt, setup.sh → Dosyalar
"Maksimum 3 seviye derinlik" Olayı....?!
"Maksimum 3 seviye derinlik", dizin ağacının en fazla 3 katman derinliğe kadar görüntülenmesi anlamına gelir.
Bunu bir örnekle açıklayalım:
Eğer tam derinlikte bir tree çıktısı alırsak:
Kod: Tümünü seç
/home/kullanıcı_hesap_adı
├── Documents
│ ├── Projects
│ │ ├── Project1
│ │ │ ├── src
│ │ │ │ ├── main.c
│ │ │ │ ├── utils.h
│ │ │ │ └── utils.c
│ │ │ ├── README.md
│ │ │ └── Makefile
│ │ ├── Project2
│ │ │ ├── report.docx
│ │ │ ├── data.csv
│ │ │ └── analysis.py
│ ├── notes.txt
│ └── todo.txt
└── Downloads
├── setup.sh
├── archive.zip
└── wallpaper.jpg
Eğer tree -L 3 komutu ile derinliği maksimum 3 seviye olarak sınırlandırılırsa ;
Kod: Tümünü seç
/home/kullanıcı_hesap_adı
├── Documents
│ ├── Projects
│ ├── notes.txt
│ └── todo.txt
└── Downloads
├── setup.sh
├── archive.zip
└── wallpaper.jpg
1. Teknik Sınır: PATH_MAX Değeri
- GNU/Linux'ta bir dizinin maksimum yol uzunluğu (PATH_MAX) genellikle 4096 karakterdir (4 KB).
- Bir dizin ne kadar derin olursa, tam yolu (/home/kullanıcı_hesa_adı/.../.../...) o kadar uzar.
- Eğer tam yol uzunluğu PATH_MAX değerini aşarsa, sistem bu dizine erişemez ve hata alırsınız.
Kod: Tümünü seç
bash: cd: File name too long
Bunlar ;
No such file or directory → cd komutuyla uzun yolu takip ettiğimizde oluşur.
Argument list too long → rm -r gibi işlemlerle çok uzun yolları işlerken hata vermeye meyillidir sistemin kendisi...
Bu hatalardan kaçmak için :
"Daha kısa dizin/ad yapıları kullanmak...
Sembolik linkler (ln -s) ile uzun dizinlere kısa erişim noktaları oluşturmak..."
kesin bir çözümleme sağlar.
2. Pratik Sınır: Dosya Sistemi ve Uygulamalar
Linux çekirdeği dizinlerin iç içe kaç katman olacağına dair kesin bir sınır koymaz, ancak kullandığımız dosya sistemi (ext4, XFS, Btrfs vs.) bazı pratik kısıtlamalara sahiptir.
Örneğin, ext4 dosya sisteminde tek bir dizin içinde maksimum 64.000 alt dizin olabilir.
Ancak çok derin dizin yapıları performansı olumsuz etkileyebilir ve bazı programlar (ls, find, tree) çok derin dizinlerde hata verebilir.
3. Kabuk (Shell) ve Uygulama Kısıtlamaları
Bazı komutlar veya programlar belirli bir derinlikten sonra çalışmaz:
tree komutu → Çok derin dizin yapılarında bellek tüketimi artar ve işlem uzun sürebilir.
rm -r komutu → Aşırı derin dizinleri silerken "Argument list too long" hatası alabilme ihtimali yüksektir.
cd komutu → Çok derin dizinlerde çalışırken bazı kabuklar (bash, zsh) sorun yaşayabilir.
Not'u Özetlersek ;
- Teorik olarak Linux'ta dizin derinliği için doğrudan bir sınır yoktur.
- Pratikte, 1000'den fazla iç içe dizin oluşturmak sistemde sorunlara yol açabilir.
- 4096 karakterlik PATH_MAX sınırına ulaştığınızda, daha fazla derinlik oluşturamazsınız.
EK NOTSAL BİLGİLENDİRME : (Çift Sistem Kullanan PC Kullanıcıları İçin)
Windows NTFS (New Technology File System) dosya sisteminde, tek bir dizin içinde oluşturulabilecek maksimum alt dizin veya dosya sayısı teorik olarak 4.294.967.295 (2³² - 1) ile sınırlıdır.
Ancak pratikte, performans ve diğer faktörler nedeniyle bu sınır çok daha düşüktür:
Bir klasörde çok fazla dosya veya alt klasör varsa:
- Windows Gezgini ve bazı programlar klasörü açarken yavaşlayabilir veya çökebilir.
- NTFS dizin yapısı B-Tree (Dengeli Ağaç) yapısını kullandığından, büyük klasörlerde arama ve erişim yavaşlar.
- Tam dosya yolu uzunluğu: 32.767 karakter (\\?\ öneki ile).
- Tek bir dosya veya klasör adı: 255 karakter.
- Maksimum dosya sayısı: 4 milyar civarı (disk boyutuna bağlı).

Sonuç olarak, NTFS, tek bir dizin içinde EXT4'e kıyasla çok daha fazla alt klasör ve dosya destekler. Ancak büyük klasörlerde (derinliği fazla olan)performans sorunları yaşanması kaçınılmazdır.
ÖZEL NOT : (WindowsPC Kullanıcıları İçin)
Benim Windows 7 SP1 zamanından kalma kullandığım bir yapı...Alın sizin olsun
Kod: Tümünü seç
tree "C:\Users\Kullanıcı_adı\Document" /f /a /L 3
echo.
echo Dosya Bilgileri:
dir "C:\Users\Kullanıcı_adı\Document" /T:C /Q /S
Bu eski kadim .cmd betik, "C:\Users\Kullanıcı_adı\Document" dizinindeki dosya ve klasörleri 3 seviyeye kadar ağaç yapısında görüntüler, ardından o dizindeki dosyaların oluşturulma tarihi, sahiplik ve alt dizinleri hakkında detaylı bilgiler sağlar.
GNU/Linux'taki
Kod: Tümünü seç
tree -a -L 3 -h -p -u -g -D {Dizinin Tam Yolu}
İsterseniz bu .cmd betiği .vbs betiğe çevirebiriz. (denemedim sadece veriyorum)
Kod: Tümünü seç
' Kullanıcıdan dizin konumu al
Dim folderPath
folderPath = InputBox("Lütfen dizin yolunu girin (örneğin: C:\Users\KullaniciAdi\Belgeler):", "Dizin Seçin")
' Kullanıcı bir yol girerse işlemi başlat
If folderPath <> "" Then
' Dosya sistemi nesnesini oluştur
Set fso = CreateObject("Scripting.FileSystemObject")
' Dizin var mı kontrol et
If fso.FolderExists(folderPath) Then
' Dizin yapısını yazdır
WScript.Echo "Dizin Yapısı: " & vbCrLf
Call ListFolder(folderPath, 3)
WScript.Echo vbCrLf & "Dosya Bilgileri: " & vbCrLf
' Dosya bilgilerini yazdır
Call ListFiles(folderPath)
Else
WScript.Echo "Girilen dizin geçerli değil!"
End If
Else
WScript.Echo "Dizin yolu girilmedi."
End If
' Dizin yapısını listeleyen fonksiyon
Sub ListFolder(ByVal folderPath, ByVal level)
Dim folder, subFolder, file, fso
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(folderPath)
' Dizin ismini yazdır
If level > 0 Then
WScript.Echo String(level, " ") & folder.Name
End If
' Alt dizinleri ve dosyaları listele
If level > 1 Then
For Each subFolder In folder.SubFolders
Call ListFolder(subFolder.Path, level - 1)
Next
End If
If level > 0 Then
For Each file In folder.Files
WScript.Echo String(level, " ") & " " & file.Name
Next
End If
End Sub
' Dosya bilgilerini yazdıran fonksiyon
Sub ListFiles(ByVal folderPath)
Dim fso, folder, file
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(folderPath)
For Each file In folder.Files
WScript.Echo "Dosya Adı: " & file.Name
WScript.Echo " Oluşturulma Tarihi: " & file.DateCreated
WScript.Echo " Sahip: " & fso.GetFile(file.Path).Attributes
WScript.Echo " Boyut: " & file.Size & " bytes"
WScript.Echo "----------------------------"
Next
End Sub
Betikte, dizin yapısını 3 seviyeye kadar gösterecek şekil de dizayn edilmiştir ve alt dizinlerdeki dosyaların bilgilerini de oluşturulma tarihi, sahiplik ve boyut bilgisiyle beraber verecek özeliği de vardır.

