Jump to content

Klasör Içini Silme


Mehmet
 Share

Recommended Posts

klasör içini komple temizleme içinde adını bilmediğimiz dosyaların tümünü silme
örneğin
C:\WINDOWS\Prefetch
C:\DOCUME~1\mehmet\LOCALS~1\Temp
bu klasörlerin içi temizlenecek ama klasör silinmeyecek
bunu DirRemove ile komple silebiliriz ve DirCreate ilede tekrar aynı isimde klasörü oluşturabiliriz
ama bunu bir çok klasör için uygulayacağımdan o klasörler zarar görebilir diye sadece klasör içini nasıl silebilirim
Link to comment
Share on other sites

[font="Georgia"]Bi çalışmamda kullanmıştım, kendine göre düzenlersin..[/font]
[font="Georgia"]
[/font]
[font="Georgia"][codebox]#Include
#Include

$Debug=0

Func KlasorBosalt($Klasor)
$TumDosya=_FileListToArray($Klasor,"*",0)
If $Debug Then MsgBox(0,"",$Klasor)
If IsArray($TumDosya) Then
If $Debug Then
_ArrayDisplay( $TumDosya,$Klasor)
EndIf
For $i = 1 To $TumDosya[0]
FileDelete($Klasor & "\" & $TumDosya[$i])
DirRemove($Klasor & "\" & $TumDosya[$i], 1)
Next
EndIf
EndFunc

KlasorBosalt (@HomeDrive & @HomePath & "\Local Settings\Temp")

KlasorBosalt (@HomeDrive & @HomePath & "\Local Settings\Temporary Internet Files\Content.IE5")
KlasorBosalt (@HomeDrive & @HomePath & "\Local Settings\Temporary Internet Files")
;KlasorBosalt (@HomeDrive & @HomePath & "\Cookies")
KlasorBosalt (@HomeDrive & @HomePath & "\Local Settings\History")
KlasorBosalt (@HomeDrive & "\Temp\Temporary Internet Files")
KlasorBosalt (@WindowsDir & "\Temp")
KlasorBosalt (@HomeDrive & @HomePath & "\Recent")
KlasorBosalt (@HomeDrive & @HomePath & "\Application Data\Microsoft\Office\Recent")
KlasorBosalt (@HomeDrive & @HomePath & "\Local Settings\Temp")
MsgBox(0, "Durum", "Geçici doyalarınız silinmiştir.")[/codebox]
[/font]

Edited by SimpsoN_Bart
Link to comment
Share on other sites

[codebox]Func _FileFolderList($path, $ext="*")
Dim $return[2][1000000]
If StringRight($path,1) <> "\" Then $path &="\"
$search = FileFindFirstFile($path & "*."&$ext)
If @error = 1 Then SetError(2)
If Not StringInStr(FileGetAttrib ($path), "D") Then Return SetError(1)
$afile = 0
$folder = 0
While 1
$file = FileFindNextFile($search)
If @error = 1 Then ExitLoop
If @extended = 1 Then
$folder += 1
$return[1][$folder]=$path & $file
Else
$afile += 1
$return[0][$afile]=$path & $file

EndIf
WEnd
FileClose($search)
$return[1][0]=$folder
$return[0][0]=$afile
if $folder >= $afile Then ReDim $return[2][$folder+1]
if $folder < $afile Then ReDim $return[2][$afile+1]
Return $return
EndFunc[/codebox]

Kendim için yazdığım bi fonksiyon _FileFolderList ile aynı görevi yapar aslında ama benim ona uyuzluğum var :) Şöyle bi örnek yapabiliriz,

[codebox]$sHersey=_FileFolderList("C:\Users\Talha\Desktop\Yeni klasör3") ; istersen bi parametre daha ekleyip belirli uzantıların dönmesini sağlayabilirsin.
For $i=1 To $sHersey[0][0]
FileDelete($sHersey[0][$i])
Next
For $i=1 To $sHersey[1][0]
DirRemove($sHersey[1][$i],1)
Next
[/codebox]

Olmadı ilk dediğin gibi yapıp ilk özellikleri bi değişkende depolatıp sonra tekrar o özellikleri verebilirsin.Kolay gelsin.

Link to comment
Share on other sites

[font="Georgia"]3 kere düzenledim olmuyor olmuyor [img]http://www.tnctr.com/public/style_emoticons/default/help.gif[/img][/font]
[font="Georgia"]Neyse sağlık olsun ama işe yarar bi çalışmadır ccleaner den bozma temp silici :)[/font]

Link to comment
Share on other sites

teşekkürler ikinizin kodlarıda işime yaradı SimpsoN_Bart senin yazılmayan File ve Array kütüphanlerini birde ben deniyeyim başkasınada lazım olur diye bakalım olcakmı :)
[codebox]
#Include <File.au3>
#Include <Array.au3>

$Debug=0

Func KlasorBosalt($Klasor)
$TumDosya=_FileListToArray($Klasor,"*",0)
If $Debug Then MsgBox(0,"",$Klasor)
If IsArray($TumDosya) Then
If $Debug Then
_ArrayDisplay( $TumDosya,$Klasor)
EndIf
For $i = 1 To $TumDosya[0]
FileDelete($Klasor & "\" & $TumDosya[$i])
DirRemove($Klasor & "\" & $TumDosya[$i], 1)
Next
EndIf
EndFunc

KlasorBosalt (@HomeDrive & @HomePath & "\Local Settings\Temp")

KlasorBosalt (@HomeDrive & @HomePath & "\Local Settings\Temporary Internet Files\Content.IE5")
KlasorBosalt (@HomeDrive & @HomePath & "\Local Settings\Temporary Internet Files")
;KlasorBosalt (@HomeDrive & @HomePath & "\Cookies")
KlasorBosalt (@HomeDrive & @HomePath & "\Local Settings\History")
KlasorBosalt (@HomeDrive & "\Temp\Temporary Internet Files")
KlasorBosalt (@WindowsDir & "\Temp")
KlasorBosalt (@HomeDrive & @HomePath & "\Recent")
KlasorBosalt (@HomeDrive & @HomePath & "\Application Data\Microsoft\Office\Recent")
KlasorBosalt (@HomeDrive & @HomePath & "\Local Settings\Temp")
MsgBox(0, "Durum", "Geçici doyalarınız silinmiştir.")
[/codebox]
[color="#FF0000"]Edit: oldu sanırım herhalde belki[/color] ;)
buda Extrası olsun :)
ShellExecuteWait("RunDll32.exe"," InetCpl.cpl,ClearMyTracksByProcess 255")

Edited by MeHMeTBeN
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...