logo
down
shadow

Listing files in two separate directories in Clojure


Listing files in two separate directories in Clojure

By : Eka Arisman
Date : November 21 2020, 03:00 PM
Any of those help You were not returning something from your let form, so notice here p-files is outside the []:
code :
(let [p-files-dir-1 (System/getenv "PROGRAMFILES(X86)")
      p-files-dir-2 (System/getenv "PROGRAMFILES")
      p-files-dir-file-1 (File. p-files-dir-1)
      p-files-dir-file-2 (File. p-files-dir-2)
      p-files (map str (concat 
                         (.listFiles p-files-dir-file-1) 
                         (.listFiles p-files-dir-file-2)))]
  p-files)
(map str (concat ["a" "b" "c"] ["d" "e" "f"]))
;; => ("a" "b" "c" "d" "e" "f")
(defn env-files [file-name]
  (some-> file-name
          System/getenv
          File.
          .listFiles))
(map str (concat
             (env-files "PROGRAMFILES(X86)")
             (env-files "PROGRAMFILES")))


Share : facebook icon twitter icon
Listing available files and directories in Matlab

Listing available files and directories in Matlab


By : Harry V
Date : March 29 2020, 07:55 AM
help you fix your problem You can use DIR recursively.
The output of dir is a structure where the first and the second element are current and parent directory, respectively, and the rest are the contents of the folder listed. Step through those. If it's a directory (dirOutput.isdir == 1), call dir on it. If it's a file, add it to the list.
How can i get the listing of files and directories of a path using C++?

How can i get the listing of files and directories of a path using C++?


By : Charlotte Pryor
Date : March 29 2020, 07:55 AM
wish helps you Finally I completed the short project.To get the list of files and sub directories, I made use of .NET Framework namespace "System".It has got classes like "FileInfo" and "DirectoryInfo"(both belong to System::IO) which do the above required task.But here,all the string related stuff is of System::String , not of std::string.To convert System::String to std::string, I used the following code(I got this conversion's code from a forum and it worked fine without any error):
code :
string Str2str(String ^a)
{
array<Byte> ^chars = System::Text::Encoding::ASCII->GetBytes(a);
pin_ptr<Byte> charsPointer = &(chars[0]);
char *nativeCharsPointer = reinterpret_cast<char *>(static_cast<unsigned char *>(charsPointer));
string native(nativeCharsPointer, chars->Length);
return native;
}
 #include<iostream>
        #using<mscorlib.dll>
        using namespace strd;        
        using namespace System;
        using namespace System::IO;


int main()
    {int count=50;
string name[count];//to hold directories names
string b;
int s=0;
DirectoryInfo^ di = gcnew DirectoryInfo("d:\\");
if(di->Exists)
{array<DirectoryInfo^>^diArr = di->GetDirectories();
Collections::IEnumerator^ myEnum = diArr->GetEnumerator();
while ( myEnum->MoveNext() )
{DirectoryInfo^ dri = safe_cast<DirectoryInfo^>(myEnum->Current);


      String ^a=(dri->Name->ToString());
      int n=b.size();
      b=Str2str(a); `// code given in the starting`
      if (s<count)
      {name[s]=b;
      s++;}

}
How to filter files when listing directories in C#

How to filter files when listing directories in C#


By : user3228719
Date : March 29 2020, 07:55 AM
will be helpful for those in need I am trying to filter outout of a method, so only files with a "FF-" prefix will be returned. , Like this?
code :
FileInfo[] Files = dinfo.GetFiles("FF-*.*");
* - Zero or more characters.  
? - Exactly zero or one character. 
Listing directories which contain only pdf files

Listing directories which contain only pdf files


By : user2773243
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I’d like to access and show all the device directories that contain only pdf files
code :
listDir = (path, dirName) => {
   this.fileNavigator
     .listDir(path, dirName)
   .then(entries => {
     this.items = entries;
   })
  .catch(this.handleError);
}
Listing directories containing more than 2 files

Listing directories containing more than 2 files


By : Francesco Manca
Date : October 06 2020, 04:00 AM
it fixes the issue Using -maxdepth 1 was simply searching at the first level of the directory which is the directory itself. To search within the subdirectories, I had to use -maxdepth 2 and it solved my problem.
Command used is $ find . -maxdepth 2 -type f -printf '%h\n' | sort | uniq -d.
Related Posts Related Posts :
shadow
Privacy Policy - Terms - Contact Us © voile276.org