Listing Content Of Directory In Java 📁
In order to list the contents of a directory, below program can be used. 🗄
This program simply receives the names of the all sub-directory and files in a folder in an Array and then that array is sequentially traversed to list all the contents. 💎
➖➖➖➖➖➖➖➖➖➖➖➖
#java #io
@ProgrammingTip
In order to list the contents of a directory, below program can be used. 🗄
This program simply receives the names of the all sub-directory and files in a folder in an Array and then that array is sequentially traversed to list all the contents. 💎
import java.io.*;
public class ListContents {
public static void main(String[] args) {
File file =
new File("//home//user//Documents/");
String[] files = file.list();
System.out.println (
"Listing contents of " + file.getPath()
);
for(int i=0 ; i < files.length ; i++) {
System.out.println(files[i]);
}
}
}
➖➖➖➖➖➖➖➖➖➖➖➖
#java #io
@ProgrammingTip
Server.MapPath Equivalent in ASP.NET Core 💁🏻♂️
Web Developers who use Microsoft technologies have always relied on the Server.MapPath method to resolve file paths.
In classic ASP and ASP.NET Web Forms and MVC versions up to and including 5. 🕒
This method has not been included in ASP.NET Core, so what do you use instead❓
[ Webiste ] : http://bit.do/svpath
https://t.me/pgimg/45
〰〰〰〰〰〰
#AspMvc #Core #IO
@ProgrammingTip
Web Developers who use Microsoft technologies have always relied on the Server.MapPath method to resolve file paths.
In classic ASP and ASP.NET Web Forms and MVC versions up to and including 5. 🕒
This method has not been included in ASP.NET Core, so what do you use instead❓
[ Webiste ] : http://bit.do/svpath
https://t.me/pgimg/45
〰〰〰〰〰〰
#AspMvc #Core #IO
@ProgrammingTip
Telegram
Programming Tips Resources