+ Post New Thread
Results 1 to 6 of 6
Windows Thread, Delete .swf over a ceriain size in Technical; Now its .SWF I now need to delete .swf also, but wait its not that simple I need to delete ...
  1. #1
    lsheldon's Avatar
    Join Date
    Feb 2009
    Location
    Bradford
    Posts
    42
    Thank Post
    4
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Delete .swf over a ceriain size

    Now its .SWF

    I now need to delete .swf also, but wait its not that simple I need to delete .swf over a certain size as the smaller .swf files are students work and the larger ones are games.
    I want to add this to the current script if possible any ideas ?

    compact /u /s /f
    attrib * -s -H -R -A /S
    del *.zip /s /f
    del *.exe /s /f
    del *.tmp /s /f
    del Thumbs.db /s /f

    this script run's on the student file server every night and tidys the areas
    as it scans all sub files and folders also.

  2. #2
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    4,995
    Thank Post
    120
    Thanked 286 Times in 263 Posts
    Rep Power
    108
    A VB script would be best for this. It will do a WMI query for file type and file size > X . Then you can do what you want with it. If you need the flesh of it theres one of my scripts that changed file formats. You can alter that for your purposes:

    Batch image convert...

    Code:
    'WMI Script to find certain file types and run a command on them
    'Chris Hindmarch FisherMore R.C High
    'I take no responsibility if this script messes anything up ;)
    ' Use with extreme caution as it will act on **ALL** the files of the
    ' defined file type in the path
    
    strComputer = "."
    Path = "E:\Home\FMStudent" 'Path to the root of the directory to search recursively
    OutPath = ""
    OutputFormat = "jpg"
    Drive =""
    FilePath= ""
    FileSize = 0
    StrCmdLine = ""
    Ext = "bmp" ' Set the filetype you are looking for ommit the "."
    
    Set ObjShell = CreateObject("WScript.Shell")
    
    ' Replace back slashes with double back slashes else an error will occur
    Path = Replace(Path,"\","\\")
    FilePath = LCase(Path)'Convert to lower case as wmi ouputs in lower case
    
    'Get drive letter
    Drive = Left(FilePath,2)
    WScript.echo "Drive= " & Drive
    
    'Get the rest of the path
    FilePath=Right(FilePath,(Len(FilePath) -2))
    
    'Create the like query string 
    FilePath = "%" & FilePath & "%"
    
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
        
    Set colFiles = objWMIService.ExecQuery _
        ("Select Drive,Path,Extension,FileSize,FileName from CIM_DataFile where Extension = '" & ext &_ 
        "' and Drive = '" & Drive & "' and Path Like '" & FilePath & "'")
        
    WScript.echo "The Parent File Path = " & FilePath 
    'Wscript.echo "The amount of files found was " & colfiles.count
    
    If ColFiles.Count >= 1 Then
    	For Each objFile In colFiles
       'Get the full file path
    	CombinedPath = objFile.drive & objFile.Path & objFile.FileName & "." & objFile.Extension
    	WScript.Echo "THe Combined Path = " & CombinedPath
    	'Alter File path to reflect new file type
    	OutPath = Replace(CombinedPath,Ext,OutputFormat)
    	
    	'WScript.echo objFile.drive & objFile.Path & objFile.FileName & "." & objFile.Extension
    	FileSize = FileSize + objFile.FileSize
    	
    	StrCMDLine = "c:\imagemagick\convert.exe " & """" & CombinedPath & """" & " " & """" & OutPath & """"
       WScript.Echo StrCMDLine
       ObjShell.Run StrCmdLine,1,True
    	
    	'End IF
    	
    	
    	Next
    	Else
    	
    	WScript.echo "No Files Found or incorrect path specified"
    
    End If 'IF ColFiles.Count >= 1 Then
    FileSize = FileSize/1024
    WScript.echo "Disk Space in KiloBytes= " & FileSize & VbCrLf
     
    FileSize = FileSize/1024
    WScript.echo "Disk Space in Meg= " & FileSize & VbCrLf
    
    FileSize = FileSize/1024
    WScript.echo "Disk Space in Gigs= " & FileSize & VbCrLf
    Last edited by ChrisH; 27th February 2009 at 01:26 PM.

  3. Thanks to ChrisH from:

    lsheldon (27th February 2009)

  4. #3
    lsheldon's Avatar
    Join Date
    Feb 2009
    Location
    Bradford
    Posts
    42
    Thank Post
    4
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    This would be great but my experience in vbs is still limited so i would nob be sure how to manipulate the script for my needs

  5. #4

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,069 Times in 625 Posts
    Rep Power
    740
    Use Agent Ransack to search with the size limits - [ part of the Admin Bar see below ] or DL it from Agent Ransack - home

    Once finished searching you can then simply highlight the files and delete.....

  6. #5
    lsheldon's Avatar
    Join Date
    Feb 2009
    Location
    Bradford
    Posts
    42
    Thank Post
    4
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    I need to do this automatically though

  7. #6

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,069 Times in 625 Posts
    Rep Power
    740
    I would knock something up in AutoIT then using the FileGetSize function......

    Function FileGetSize



SHARE:
+ Post New Thread

Similar Threads

  1. SWF Files in Docs
    By stratisphere in forum Network and Classroom Management
    Replies: 4
    Last Post: 15th January 2009, 02:40 PM
  2. Opening swf files
    By SimpleSi in forum Windows
    Replies: 6
    Last Post: 26th November 2008, 03:03 PM
  3. .WMV to .SWF
    By danIT in forum General Chat
    Replies: 4
    Last Post: 29th May 2008, 12:19 AM
  4. Swf games in E-Mails
    By mitchell1981 in forum Windows
    Replies: 7
    Last Post: 15th February 2008, 12:19 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •