Jump to content

Find and Delete source control files (*.svn)


Recommended Posts

Hello Everybody,

I am new to AutoIT, so please be nice to me.

I need to alter a directory structure so that it can be processed by an installer. Certain types of folders (.svn) have to be located from the top folder level downwads and deleted. Filefindfirst only locates files in a certain directory. I want the Script to go from a certain point downwars through the whole directory strucuture and delete the aforementioned folders without having to enter the directory names manually.

Example: \media\.svn

the directory .svn hast be removed

than further on:

\media\cutscenes\.svn

the directory .svn hast be removed

and so on.

Does anybody have an idea how to do that ?

Thanks in advance

Protagonist

Link to comment
Share on other sites

_FileListToArray() with a flag of 2 will return only directories, you can then perform another _FileListToArray() on each directory until you find what you are looking for.

Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Link to comment
Share on other sites

Or you could simply use the _FileListToArray3() UDF it finds the subfolders also

EDIT:

Here is an example of how it works:

#include<FileListToArray3.au3>
#include <File.au3>
#include <array.au3>

$folder = FileSelectFolder("Choose a folder", "") ; Choose the folder to search in
If @error Then Exit
$filter = "*.cococo"; $filter = "*.svn" to get all svn files in dir / subdirs
$FileList = _FileListToArray3($folder, $filter, 1, 1, 1)
If @error = 4 Then
    MsgBox(0, "", "No Files\Folders Found.")
    Exit
EndIf
;_ArrayDisplay($FileList, "Files that was found")
For $i = 1 To UBound($FileList) - 1
    FileDelete($FileList[$i])
Next

You need to download the file FileListToArray3.au3 and then put it into the scriptdir

Regards

Edited by newbiescripter
Link to comment
Share on other sites

Thanks a lot for the quick answers. I could not get around to working on the script until now, but I will start immediately.

Thx once more, I will let you know as soon as I have any results.

Or you could simply use the _FileListToArray3() UDF it finds the subfolders also

EDIT:

Here is an example of how it works:

#include<FileListToArray3.au3>
#include <File.au3>
#include <array.au3>

$folder = FileSelectFolder("Choose a folder", "") ; Choose the folder to search in
If @error Then Exit
$filter = "*.cococo"; $filter = "*.svn" to get all svn files in dir / subdirs
$FileList = _FileListToArray3($folder, $filter, 1, 1, 1)
If @error = 4 Then
    MsgBox(0, "", "No Files\Folders Found.")
    Exit
EndIf
;_ArrayDisplay($FileList, "Files that was found")
For $i = 1 To UBound($FileList) - 1
    FileDelete($FileList[$i])
Next

You need to download the file FileListToArray3.au3 and then put it into the scriptdir

Regards

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...