directory-listing

How to List Directory Contents with FTP in C#?

泪湿孤枕 提交于 2019-11-26 07:38:27
问题 How to List Directory Contents with FTP in C# ? I am using below code to List Directory Contents with FTP it is returning result in XML format ,but i want only the name of directory not the whole content. How i Can do that ? public class WebRequestGetExample { public static void Main () { // Get the object used to communicate with the server. FtpWebRequest request = (FtpWebRequest)WebRequest.Create(\"ftp://www.contoso.com/\"); request.Method = WebRequestMethods.Ftp.ListDirectoryDetails; //

Get a filtered list of files in a directory

最后都变了- 提交于 2019-11-26 06:04:45
问题 I am trying to get a list of files in a directory using Python, but I do not want a list of ALL the files. What I essentially want is the ability to do something like the following but using Python and not executing ls. ls 145592*.jpg If there is no built-in method for this, I am currently thinking of writing a for loop to iterate through the results of an os.listdir() and to append all the matching files to a new list. However, there are a lot of files in that directory and therefore I am

Non-alphanumeric list order from os.listdir()

笑着哭i 提交于 2019-11-26 01:59:08
问题 I often use python to process directories of data. Recently, I have noticed that the default order of the lists has changed to something almost nonsensical. For example, if I am in a current directory containing the following subdirectories: run01, run02, ... run19, run20, and then I generate a list from the following command: dir = os.listdir(os.getcwd()) then I usually get a list in this order: dir = [\'run01\', \'run18\', \'run14\', \'run13\', \'run12\', \'run11\', \'run08\', ... ] and so

How do you get a list of the names of all files present in a directory in Node.js?

大城市里の小女人 提交于 2019-11-25 23:21:26
问题 I\'m trying to get a list of the names of all the files present in a directory using Node.js. I want output that is an array of filenames. How can I do this? 回答1: You can use the fs.readdir or fs.readdirSync methods. fs.readdir const testFolder = './tests/'; const fs = require('fs'); fs.readdir(testFolder, (err, files) => { files.forEach(file => { console.log(file); }); }); fs.readdirSync const testFolder = './tests/'; const fs = require('fs'); fs.readdirSync(testFolder).forEach(file => {