Sign in to follow this  
Followers 0
zFrank

deleting files in a folder

14 posts in this topic

hi, anyone please tell me that how can i delete some Hidden files in a folder these files have +SHR attribute. because for deleting first i need to make them normal, i dont know the names of files, i just know their extension. now let me know how to delete them.

thanks a lot in advance for help!


[font="Georgia"]GSM Expert[/font] but not AutoIt :DProud to be Admin Of : http://www.gsmhosting.net/visit my Forum... http://www.gsmhosting.net/vbb/index.php
$Life = "Happy"
If @Error Then
$Life = "Risk"

Share this post


Link to post
Share on other sites



hi, anyone please tell me that how can i delete some Hidden files in a folder these files have +SHR attribute. because for deleting first i need to make them normal, i dont know the names of files, i just know their extension. now let me know how to delete them.

thanks a lot in advance for help!

Look in DOS about DEL or ERASE comand. Both are options for files with attributes.


When the words fail... music speaks

Share this post


Link to post
Share on other sites

but these commands will also delete other files... i want to do it using autoit.

What are you talking about? These commands delete only the files you specify.

Share this post


Link to post
Share on other sites

Use

DEL /?
to read more about this command.


When the words fail... music speaks

Share this post


Link to post
Share on other sites

or u can use file delete "*.SHR"

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

or u can use file delete "*.SHR"

;) Don't do that!

EDIT: He said the files have the attributes SHR not the extension SHR :D

Edited by LongBowNZ

Share this post


Link to post
Share on other sites

srry I wrong to read, forgive me

Share this post


Link to post
Share on other sites

FileSetAttrib

FileDelete

Share this post


Link to post
Share on other sites

but after setting the attributes of files these files will become same as others and when i will try to delete them it will also delete other files in the directory with same extension. i only want to delete the files which have +SHR attribs , i dont want to delete normal files. after setting attribs of my files which i want to delete will become normal as others are, and then the delete function will delete all files included normal.

anybody pleaz help me out!@!


[font="Georgia"]GSM Expert[/font] but not AutoIt :DProud to be Admin Of : http://www.gsmhosting.net/visit my Forum... http://www.gsmhosting.net/vbb/index.php
$Life = "Happy"
If @Error Then
$Life = "Risk"

Share this post


Link to post
Share on other sites

You will have to use FileListToArray + FileGetAttrib to filter out files with these attributes.

Share this post


Link to post
Share on other sites

can i have a simple but usefull example please...?

#Include <File.au3>
 $root = @ScriptDir
 $aFiles = _FileListToArray($root, "*.*",1)
 For $X = 1 to $aFiles[0]
 $attrib = FileGetAttrib ($root & "\" & $aFiles[$X])
 
 If StringInStr($attrib, 'S') AND StringInStr($attrib, 'H') AND StringInStr($attrib, 'R') Then
FileDelete($root & "\" & $aFiles[$X])
EndIf
Next

Share this post


Link to post
Share on other sites

#Include <File.au3>
 $root = @ScriptDir
 $aFiles = _FileListToArray($root, "*.*",1)
 For $X = 1 to $aFiles[0]
 $attrib = FileGetAttrib ($root & "\" & $aFiles[$X])
 
 If StringInStr($attrib, 'S') AND StringInStr($attrib, 'H') AND StringInStr($attrib, 'R') Then
FileDelete($root & "\" & $aFiles[$X])
EndIf
Next
Thanx a lot dear, it was really helpfullll

keep the good work up! thanks again...


[font="Georgia"]GSM Expert[/font] but not AutoIt :DProud to be Admin Of : http://www.gsmhosting.net/visit my Forum... http://www.gsmhosting.net/vbb/index.php
$Life = "Happy"
If @Error Then
$Life = "Risk"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0