Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.4k views
in .NET FTP by (280 points)
I am using edtFTPNetPro free component. I have the following queries:

How i recursively populate a tree type structure using the directories and sub directories in the root folder.I mean to say is there any class like DirectoryInfo in System.IO namespace
DirectoryInfo di=new DirectoryInfo("path");

How i can set the current working Directory using path.
How can i check whether an object is File or Directory?
How Can i move/copy files from one directory to another in same server under same rootdirectory.
Can i move the directory to different location in same server under same rootdirectory.


Please reply asap.
Thanks

9 Answers

0 votes
by (51.6k points)
edtFTPnet/PRO is not free. Are you referring to edtFTPnet/Free (a.k.a. edtFTPnet)?

- Hans (EnterpriseDT)
0 votes
by (280 points)
I am using edtFTPnetPRO .But i also like to know whether edtFTPnet/Free is capable to cater my requirements.
Please let me know how to solve my queries using edtFTPnet/Free and edtFTPnetPRO .
Waiting for early reply
0 votes
by (51.6k points)
How i recursively populate a tree type structure using the directories and sub directories in the root folder. I mean to say is there any class like DirectoryInfo in System.IO namespace
DirectoryInfo di=new DirectoryInfo("path");

The latest trial release of edtFTPnet/PRO, ExFTPConnection and SecureFTPConnection has a new method
FTPFile[] GetFileInfos(string directory, bool includeSubdirectories)
, which will optionally return the contents of the subdirectories. FTPFile has a new property, Children, which, if it is a directory, will contain the entries of that directory.

We have no plans to add this functionality to edtFTPnet/Free.
How i can set the current working Directory using path.

FTPConnection.ServerDirectory, ExFTPConnection.ServerDirectory, SecureFTPConnection.ServerDirectory
How can i check whether an object is File or Directory?

FTPFile.Dir
How Can i move/copy files from one directory to another in same server under same rootdirectory.

Some servers allow you to move files between directories using the same command as is used for renaming. You can do this in all versions of edtFTPnet using the Rename method. For servers that don't support this you'll have to download the file to your local machine, upload it to the new location and delete the old copy.
Can i move the directory to different location in same server under same rootdirectory.

No, you'll have to download the entire directory, upload it to the new location, and then delete the old one. edtFTPnet/Express and edtFTPnet/PRO have methods for downloading, uploading and deleting directories, but these are not present in edtFTPnet/Free.

- Hans (EnterpriseDT)[/i][/quote]
0 votes
by (280 points)
I have downloaded version 4.1.1.0 . How i will get latest trial release of edtFTPnet/PRO? Can you please send me any link to download latest trial release of edtFTPnet/PRO and check the enhanced functionality.
0 votes
by (51.6k points)
The current trial is version 4.1.2.0. You can download it from here.

- Hans (EnterpriseDT)
0 votes
by (280 points)
I have already downloaded the latest version (4.1.2.0) . In System.IO.DirectoryInfo class we have di.Name and di.FullName
to get Folder Name and its full path. But i am getting Folder Name but not the correct full path of the Folder in the following code:

private void BuildNode(FTPFile[] ftpFile)
{
  foreach (FTPFile file in ftpFile)
  {
    if(file.Dir)
    {
      Response.Write(file.Name);
      Response.Write(file.Path);
    }
    BuildNode(ftpConnection.GetFileInfos(file.Path); //***error is coming File not found
  }
}


***Please tell me how i can send the virtual path of Folder in BuildNode() method as parameter
0 votes
by (51.6k points)
Have you tried calling:
ftpConnection.GetFileInfos("/", true);


This is supposed return an array of FTPFile object - one for each file and subdirectory in /. Each of the FTPFile objects that is a subdirectory should have all of the file/directories in that subdirectory in the FTPFile.Children array. In this way the entire directory-tree should be accessible.

- Hans (EnterpriseDT)
0 votes
by (280 points)
I have not found any method which takes two parameters in ftpConnection.GetFileInfos() method .
ftpConnection.GetFileInfos() method has two overloaded form---one taking no argument and the second one takes only one
string type argument.
Moreover My code will recursively display the Folders in treeform. So how can i fixed the Path of Folder as "/" ? I have to pass value of virtual path of folder dynamically.

Say MyFolder Structure is as follows:
Folder1----->Folder2----->Folder3.........

In my code the 1st iteration will run perfectly that means Folder1 and its Path will display properly.Because Folder1 is under rootFolder. But in 2nd iteration it will try to find the Folder2 under rootFolder and throws the error "File Not Found".
So I need to Pass The Path Like that /Folder1/Folder2.....and so on ........

Please guide me if i am wrong. I would appreciate if you can send a complete Code.
0 votes
by (51.6k points)
I've downloaded the trial (version 4.1.2) and verified that the method that does the recursive directory listing is there. It seems like a waste of time for me to explain to you to write the duplicate the method when it's already in the component. Could you please right-click on the DLL that you are linking against, select Properties and then the Details tab. This should tell you the version number of the DLL. It should be 4.1.2.

- Hans (EnterpriseDT)

Categories

...