#113623 - 2004-02-09 01:28 PM
please please help!!!
|
juanbabi
Fresh Scripter
Registered: 2004-02-09
Posts: 15
|
I an new to kixstart and my boss asked me to enter to a share folder and delete all the files that there size is zero but dont delete any folders.this share folder is a lot og gigas. can some one help me write a script ?
thanks u very very much!!!
|
Top
|
|
|
|
#113625 - 2004-02-09 01:46 PM
Re: please please help!!!
|
juanbabi
Fresh Scripter
Registered: 2004-02-09
Posts: 15
|
I work on windows 2000 server.
there is a share on one computer \\computerneme\sharename .
in this share there are many diffarent files that there size is 0 kb.all those files must be deleted.
thanks.
|
Top
|
|
|
|
#113627 - 2004-02-09 01:58 PM
Re: how to delete empty files
|
juanbabi
Fresh Scripter
Registered: 2004-02-09
Posts: 15
|
how I need to save the script? as script.kix? the folder size is 180 giga.
is it a problem?
|
Top
|
|
|
|
#113630 - 2004-02-09 02:52 PM
Re: please please help!!!
|
juanbabi
Fresh Scripter
Registered: 2004-02-09
Posts: 15
|
I need to run this only once.
the problem with windows search is that I can find the files but there are thousends of tham so whan I try to mark tham to delete I can mark only 100-200 each time and whan I delete tham windows tries to refrash but It takes a lot of time untill it does.sometimes it even freeze (this folders has a lot of sub folders in total the sixe is 160 giga.
thanks!!
|
Top
|
|
|
|
#113632 - 2004-02-09 03:13 PM
Re: how to delete empty files
|
juanbabi
Fresh Scripter
Registered: 2004-02-09
Posts: 15
|
Im reading it right now man!! on page 22...
the issue is that I need it ASAP !! so I reading the menual and also deleting the files manually. why can u help ? It is not so simple to understand I never programed anything !!
|
Top
|
|
|
|
#113633 - 2004-02-09 03:15 PM
Re: how to delete empty files
|
juanbabi
Fresh Scripter
Registered: 2004-02-09
Posts: 15
|
where can I find some simple examples?
thanks
|
Top
|
|
|
|
#113635 - 2004-02-09 03:21 PM
Re: how to delete empty files
|
Jochen
KiX Supporter
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
|
Top
|
|
|
|
#113638 - 2004-02-09 03:31 PM
Re: how to delete empty files
|
juanbabi
Fresh Scripter
Registered: 2004-02-09
Posts: 15
|
whan I do "at most 0 " i dont recive nothing in the output.
I need to put at least 1 kb. and than I recive a lot of resolts. my boss told mr that I need to chank some other folders to. 160 gig x3 files.
come on guys please help!!!
thanks
|
Top
|
|
|
|
#113639 - 2004-02-09 03:46 PM
Re: how to delete empty files
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
We cannot help you to write a script as you do not have enough experience, and it is a more complicated issue than you think it is.
Here is a script which will do the job: Code:
Break ON $gDiscard=SetOption("Explicit","ON")
Dim $sStartDir,$sRoutine
$sStartDir="C:\temp" $sRoutine="udfDeleteZeroLengthFile($$sEntry)"
udfEnumDir($sStartDir,$sRoutine)
Function udfEnumDir($sDir,$sCall) Dim $sEntry,$sDiscard $sEntry=Dir($sDir) While Not @ERROR If Not($sEntry="." OR $sEntry="..") $sEntry=$sDir+"\"+$sEntry If GetFileAttr($sEntry) & 16 udfEnumDir($sEntry,$sCall) EndIf $sDiscard=Execute($sCall) EndIf $sEntry=Dir() Loop EndFunction
Function udfDeleteZeroLengthFile($sPath) If Not (16 & GetFileAttr($sPath)) If GetFileSize($sPath)=0 If @ERROR=0 "File "+$sPath+" is zero length - deleting..." ? Del $sPath If @ERROR "Error deleting file: "+@ERROR+", "+@SERROR ? EndIf EndIf EndIf EndIf EndFunction
Change the variable "$sStartDir" to match the directory that you want to purge, and run the script to delete zero length files.
I strongly suggest that you backup the file store before you begin the delete.
|
Top
|
|
|
|
#113642 - 2004-02-09 05:06 PM
Re: how to delete empty files
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Lonk - The links and content are updated to the new board format. Thanks for the heads-up.
Kent
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 248 anonymous users online.
|
|
|