How can I list all the files in folder on tomcat?

The DefaultServlet of Tomcat is by default configured to not show directory listings. You need to open Tomcat’s own /conf/web.xml file (look in Tomcat installation folder), search the <servlet> entry of the DefaultServlet and then change its listings initialization parameter from <init-param> <param-name>listings</param-name> <param-value>false</param-value> </init-param> to <init-param> <param-name>listings</param-name> <param-value>true</param-value> </init-param> Keep in mind that this … Read more

How to List Directory Contents with FTP in C#?

Try this: FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create(uri); ftpRequest.Credentials =new NetworkCredential(“anonymous”,”janeDoe@contoso.com”); ftpRequest.Method = WebRequestMethods.Ftp.ListDirectory; FtpWebResponse response = (FtpWebResponse)ftpRequest.GetResponse(); StreamReader streamReader = new StreamReader(response.GetResponseStream()); List<string> directories = new List<string>(); string line = streamReader.ReadLine(); while (!string.IsNullOrEmpty(line)) { directories.Add(line); line = streamReader.ReadLine(); } streamReader.Close(); It gave me a list of directories… all listed in the directories string list… tell me … Read more

Getting a list of folders in a directory

I’ve found this more useful and easy to use: Dir.chdir(‘/destination_directory’) Dir.glob(‘*’).select {|f| File.directory? f} it gets all folders in the current directory, excluded . and … To recurse folders simply use ** in place of *. The Dir.glob line can also be passed to Dir.chdir as a block: Dir.chdir(‘/destination directory’) do Dir.glob(‘*’).select { |f| File.directory? … Read more

Non-alphanumeric list order from os.listdir()

You can use the builtin sorted function to sort the strings however you want. Based on what you describe, sorted(os.listdir(whatever_directory)) Alternatively, you can use the .sort method of a list: lst = os.listdir(whatever_directory) lst.sort() I think should do the trick. Note that the order that os.listdir gets the filenames is probably completely dependent on your … Read more