VS 2010 Add Directories / Files And Start Scanning?
Apr 21, 2011
I'm re-doing a small application I made a long time ago. It's similar to CCleaner, where it scans specific directories and removes temp files.My old application worked, but it was messy and only had a handful of locations. The new version has a ton more locations and files, but that creates a problem with how the original app was designed.In the old app (I made this a very long time ago) everything was just jammed into the main class, including variables, methods, etc. There wasn't a whole lot of thought put into it.Now, I'm trying to figure out the best way to make this class so when I'm done, I can release it to the community and it be easy to use.The main problem I'm having is how I should set up the methods. There are so many different types of directories and files, that I'm not sure if I should create a separate class for each method, or have a bunch of methods in one class or have one method in one class.
There are some directories that need to be searched recursively, some that don't, some files need a filter and others don't. I think that's the extent that I need.So, what do you all think is the best option so that it will be easy for the end user to just add the directories/files and start scanning?Right now, I have a base class that has two properties. One for directories and one for files, both of which are arrays.Actually, just as I'm typing this, I'm thinking I could create a class that represented a directory and another that represented a file. Both classes would have properties set for them that I could use in the main scanning class. That would allow me to identify what was needed for that directory/file, like recursive searching and filters.
I need to list all files folders, subfolders and subfolder files under a selected directory in a list box not sure how to do the logic in the last amount of code lines to enumerate all subfolders dna files.Here is what I have so far:
Dim OldProfileDir As String Dim NewProfileDir As String Dim Newdocs As String = "" Dim Olddocs As String = ""
Dim fileList As Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Computer.FileSystem.GetFiles(FolderDialog1.SelectedPath, FileIO.SearchOption.SearchTopLevelOnly) For Each topLvlFile As String In fileList
[code]....
The above code reads all the files & directories in a selected path. It ignores any hidden folders, like it suppose to. Except it doesn't ignore folders inside of the hidden folders that it finds & I need it to.I can't quite wrap my head around how to make it ignore all folders & files inside of a hidden folder that it find.
I'm not really sure where to begin for this. I'd like to scan a specified server directory for all files that it contains in the directory. (I will then compare the sizes to files already existing on the user's machine, but that I've got covered.)
If there's any way I could get around using FTP, I'd be very grateful, as this won't be entirely secure.
I did some exploring of the WebClient and WebRequest classes, but failed to conceive of a way to do this.
I need to check files in one directory that end in 'ilk' and compare it to another directory with files that end in 'txt'. If the file name matches (with the exception of the extension), then I want to delete the file that ends with 'ilk'.
I want my to create an explorer like application. What control should i use to show the contents of a directory.I tried listview and listbox. Unfortunately i was unable to add items in a listview using the function getdirectories("D:")I managed to do so with listbox control. But how can i distinguish whether the selected entry is a file or a directory. Code snippet is given below :
Private Sub ListBox1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick <strong>sel = ListBox1.SelectedItem</strong> ListBox1.Items.Clear()
[code]....
I want that if thesel is file, then it'll be open in its default application,i.e. using system.process.start(sel.filetype).Else if sel is a directory then the directory will open.
I have been asked to transfer multiple directories and their files from one drive to another but using a different directory name i.e Source Drive equals a: and the destination drive equals s:CATE ResultsA380, plus the orginal directory and files must be added to the destination path.
I am using the following code to add all files and sub-directories to a Treeview control. The user can select a directory (using a folder browser dialog) and this code will add that directory, and all it's files and sub-directories, to the Treeview:
[Code]....
I have tried a few ways, mainly 'copying' the code from this recent codebank submission. However, I keep getting the obvious cross-thread call issue that I am adding nodes to the 'node' parameter, which is not allowed.
I am at a loss at how to do this otherwise. How can I update a Treeview like this if I have to recursively add nodes to the 'node' parameter, which is not 'available' in a separate thread?
So this is what I have right now, I can get it to copy But I am wanting to rename the files with the date inside of the new Directory name, It is going to be used for making a copy of outlook.pst files. But as you can see I can't put in concrete names of where to save it because I want the user to be able to choose where to save it as it will be saved on a server with folders for each individual user.
Public Class Form1 Dim Folder1 Dim Folder2 Dim FolderBrowserDialog1 As New FolderBrowserDialog Dim FolderBrowserDialog2 As New FolderBrowserDialog Dim currentDate As Date = Date.Now [Code] .....
I wonna delete/create directorys on the FTP server and delete files. i have used my.computer.network.upload/downloadfile but i cant do much more whit that ..
I'm working on a VB.NET program that will automatically backup my work to my FTP server. So far I am able to upload a single file, by specifying a file name using this:
Iam making a antivirus program in Visual basic and i have to know how to get the files from a directories directory etc. And how to add them to a listbox like
1map-get files 1map-get directories 2map (directories in 1 map)get files 2map -Get directories and so on...¨
I'm having a problem when I list .rar-files into a ListBox. I can list .rar-files OK from subdirectories, but what I want to determine if the file is actually the first part of .rar-archive. The new .rar-format packs files like: Archive.part01.rar Archive.part02.rar Archive.part03.rar ...
So I have no idea when I'm listing the first part of the archive or actually listing the other parts. Function UpdateFiles(ByVal FolderPath As String) As Boolean 'If FolderPath is empty, return false If FolderPath = "" Then Return False End If [Code] ......
I need to upload a large set of files and directories to my web server, all of the files that I want to upload to my server are located in "C:Files_To_Upload" directory, it contains thousands of files and maybe 100 directories/sub directories so I don't want to have to specify each specific sub folder and file - jmcilhinney's ftp example which I am currently working with shows a way to upload all of the files from a specific directory, but not subfolders and their files. How can I get it to also upload the sub folders and their files?
Code I am using based on jmcilhinney's threaded ftp example:
Private Sub UploadFolder(ByVal source As String, ByVal destination As String) For Each file As String In IO.Directory.GetFiles(source) Threading.ThreadPool.QueueUserWorkItem(AddressOf UploadFile, _
In VB.NET win Application, While using FileSystem.CopyDirectory to copy a directory to the destination path, it produces IOEXception was caught - "Couldnot complete operations on some files or directories".
I am using Visual Studios 2005 and I am creating an application for our IT Security.Part of the program is for documents and procedures. What I am trying to do is automatically create a menu based on the folders and files. So far I have it taking into account the base folder and one subfolder level and files within it, but I want it to automatically also take into account any subfolders and files that may be added at a later date without having to replicate the code below for each new level. My code is as follows, it is very messy as I am not a programmer.
Code: Public Sub ISMSMenus() Dim clsMenuName As ToolStripMenuItem = CType((My.Forms.FrmMainScreen.TSMISMS), ToolStripMenuItem)[code]....
I am trying to put some Visual Basic Solutions/Projects into Source Code Control. Is there a list anywhere of all the Directories/Files that are created Dynamically by the compile that I can exclude from the repository. i.e.: Release or obj or dll directories If so, is it the Directory and All the files under it, or do some of the files need to remain like .xml files.
I am trying to copy a directory with sub directories and files to another location on my computer. Whenever I try, I get the following error, through my "console":
$>Error: System.IO.IOException: The directory is not empty. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive)
I get the following error message when i try to copy a directory using folder dialogue to get the path, into a predestined path. The code is as follows:
i have been trying to search a specified directory and all sub directories for all files that have the specified file extension. However the inbuilt command is useless as it errors up and dies if you dont have access to a directory.
Private Function dirSearch(ByVal path As String, Optional ByVal searchpattern As String = ".exe") As String() Dim di As New DirectoryInfo(path) Dim fi As FileInfo
[code]......
However i get an "System.NullReferenceException: Object reference not set to an instance of an object." when i try to access the data stored inside the filelist string array.
I have a series of text files in multipule diffrent sub directories. I found the following functions on the Internet:
CODE:
The functions will make a direcotry tree in my debug window, that looks something like this:
CODE:
What I want it to do is to have it return an array of relitive file paths, from the starting direcotry I give the function. Then I will use a loop to cycle though each file in the array to make certain changes.
I m trying to move all my drive's files into h drive firstly i have added all drives in threadpool for scanning and when scanning of any drive finish (Without waiting for other drive's complete ) it will move file's to h drive but it is not working as i wanted that's why i need two threadpool - one threadpool for scanning files and second threadpool for moving file's into drive's
I've commented out various things to limit it to specifically this command (example, I can swap mklink out with notepad and it works fine). The command runs fine from a DOS window, but can't be found when I use it this way. I also tried using the SHELL command just to test and I get the same results. No idea why it can't be found, as like I said it executes from the command prompt just fine.
I have a page in VB.NET that is hosted with IIS 7 on Windows 7 Home Premium. The page has code in the Page_Load event that scans through a directory and adds all sub directories to a drop down list. When testing through VS2010, it works perfectly. However, when I set the site up in IIS, the page loads correctly but nothing is added to the drop down list. My current code is: [Code]
I'm creating a program that creates new directories and subdirectories in the "C:Program Files" folder, and the operation fails if the user has the User Account Controls enabled in both Windows Vista and Windows 7. Is there a way I can give my application permission to automatically create these directories without requiring the user to turn off the User Account Controls?
I'm working on a program that will be a semi-autosubmition in web directories. I need an ideea for my directory list.I want to able to navigate from one directory to other with a "next button". Now I'm using a listbox saved in a text file, but i don't know how to make the selection for "next directory".I'm only able to click on the list. And what I thinking was if it is posible to have a better list, advanced, like a table with more columns like: url, if url is valid, pagerank for example, and maby sort by this filtres.