directory-listing

How to get list of directories in Lua

旧街凉风 提交于 2019-12-17 10:26:39
问题 I need a list of directory in LUA Suppose I have a directory path as "C:\Program Files" I need a list of all the folders in that particular path and how to search any particular folder in that list. Example Need a list of all the folder in path "C:\Program Files" Below are folder name in the above path test123 test4567 folder 123 folder 456 folder 456 789 Need to get the above in a list and then have to search for a particular string like folder 456 in folder 456 789 only. Have Tried below

List images(01.png) and descriptions(01.txt) from directory

心已入冬 提交于 2019-12-12 19:25:01
问题 How can I display images from directory and get a corresponding description with each image, give the description exists. in Directory // 01.png 01.txt 02.png 03.png 03.txt etc. to display as // <img src="01.png"><br>This is the description from the text file named 01.txt <img src="02.png"><br> <img src="03.png"><br>This is the description from the text file named 03.txt I've been searching and searching, but can't find anything, so if someone could point me in the right direction it would be

List all the files with prefixes from a for loop using Bash

南楼画角 提交于 2019-12-10 23:33:25
问题 Here is a small[but complete] part of my bash script that finds and outputs all files in mydir if the have the prefix from a stored array. Strange thing I notice is that this script works perfectly if I take out the "-maxdepth 1 -name" from the script else it only gives me the files with the prefix of the first element in the array. It would be of great help if someone explained this to me. Sorry in advance if there is some thing obviously silly that I'm doing. I'm relatively new to scripting

File explorer java

独自空忆成欢 提交于 2019-12-10 11:30:10
问题 I'd like to have some kind of file browser like Windows Explorer inside a Java Application. I just want something that's able to list file inside a folder recursively. Is there a simple way to do this ? I already tried to use JFileChooser but it's not what I want. 回答1: This snippet allows you to list all files recursivly. You could use the data to populate a JTree see this tutorial public class Filewalker { public void walk( String path ) { File root = new File( path ); File[] list = root

Getting directory listing over http

孤人 提交于 2019-12-08 22:56:58
问题 There is a directory that is being served over the net which I'm interested in monitoring. Its contents are various versions of software that I'm using and I'd like to write a script that I could run which checks what's there, and downloads anything that is newer that what I've already got. Is there a way, say with wget or something, to get a a directory listing. I've tried using wget on the directory, which gives me html. To avoid having to parse the html document, is there a way of

List files with specific extension using WinSCP .NET assembly

懵懂的女人 提交于 2019-12-08 02:49:39
问题 I am using WinSCP .NET assembly to do a download and upload through SFTP with C# .NET. I have the download function working but I am looking for a way to have the files in the remote server listed (or at least listed with a specific extension) so user only have to choose from those files with the specific extension (like .txt ) to get the files they want. Is there a way to do that with WinSCP .NET assembly? 回答1: Use the Session.ListDirectories method: RemoteDirectoryInfo directory = session

File explorer java

不羁的心 提交于 2019-12-06 11:58:18
I'd like to have some kind of file browser like Windows Explorer inside a Java Application. I just want something that's able to list file inside a folder recursively. Is there a simple way to do this ? I already tried to use JFileChooser but it's not what I want. This snippet allows you to list all files recursivly. You could use the data to populate a JTree see this tutorial public class Filewalker { public void walk( String path ) { File root = new File( path ); File[] list = root.listFiles(); for ( File f : list ) { if ( f.isDirectory() ) { walk( f.getAbsolutePath() ); System.err.println(

List files with specific extension using WinSCP .NET assembly

核能气质少年 提交于 2019-12-06 04:41:49
I am using WinSCP .NET assembly to do a download and upload through SFTP with C# .NET. I have the download function working but I am looking for a way to have the files in the remote server listed (or at least listed with a specific extension) so user only have to choose from those files with the specific extension (like .txt ) to get the files they want. Is there a way to do that with WinSCP .NET assembly? Use the Session.ListDirectories method : RemoteDirectoryInfo directory = session.ListDirectory("/home/martin"); foreach (RemoteFileInfo fileInfo in directory.Files) { string extension =

How to call a powershell script from a C code

你说的曾经没有我的故事 提交于 2019-12-04 19:33:32
In my case, I needed to call a powershell script from a c or c++ code source, found few links which were pretty clumsy and not good with c++, I simply want a roadmap if its possible invoking a powershell script which lists directory contents from a code snippet written in c or c++ C++ code : #include<iostream> #include <io.h> // For access(). #include <sys/types.h> // For stat(). #include <sys/stat.h> // For stat(). #include <string> using namespace std; void main() { string strPath = "d:\\callPowerShell.ps1"; //access function: //The function returns 0 if the file has the given mode. //The

Directory Walker for Python

元气小坏坏 提交于 2019-12-03 19:40:07
问题 I am currently using the directory walker from Here import os class DirectoryWalker: # a forward iterator that traverses a directory tree def __init__(self, directory): self.stack = [directory] self.files = [] self.index = 0 def __getitem__(self, index): while 1: try: file = self.files[self.index] self.index = self.index + 1 except IndexError: # pop next directory from stack self.directory = self.stack.pop() self.files = os.listdir(self.directory) self.index = 0 else: # got a filename