Print all File names in a folder to a text file (For Linux and Windows)

FREQUENTLY ASKED QUESTIONS (Linux)
Q. How can i print the file names of a folder into a text file.?
Q. How to print the dir/ls command output to a text file?

You can copy all file names in a folder/directory to a text file with the help of command prompt in windows and with command terminal in linux systems.
-->
After running the command, the output will write to a text file and save to current directory. The command is same for Linux and windows.

In Windows Operating systems(Windows 7,8, XP, Vista, 2008))
Open command prompt and run the below command
Command Usage:
C:\>dir <folder> >filename.txt
Example:
C:\>dir d:\Files\ >filename.txt

In Linux Operating systems(Redhat, CentOS, Fedora, Ubuntu, etc)
Open terminal and run the below command
Command Usage:
# ls > filename.txt
Example:
# ls /home/admin/ > contents.txt

Was this helpfull ?

0 comments:

Related Posts Plugin for WordPress, Blogger...

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons