Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > Your Distro > Ubuntu Help > Equivalant of Windows DIR /S > M:\File.txt using Ubuntu LiveCD?

Forgot Password?
 Ubuntu Help   Discussion and help about Ubuntu, Kubuntu, Xubuntu, and all the Ubuntu family

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds


Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 07-02-2009   #1 (permalink)
Just Joined!
 
Join Date: Jul 2009
Posts: 2
Question Equivalant of Windows DIR /S > M:\File.txt using Ubuntu LiveCD?

I have some files and folders on a drive (OS) which I want to write to a text file (long story short, drive it dying, some files I could not backup because copy failed, want to generate a list of them all).

If this was Windows I would run:
DIR /S > M:\File.txt
This would create a text file called File.txt on the M:\ drive which contained a list of all the files & folders ...

Now, because the drive was dying I am using Ubuntu LiveCD (Linux) to backup my files ... now the question is how can I accomplish the same thing in Ubuntu?

Any advice, help, information would be much appreciated.
Thanks,
Shaitan00 is offline  


Reply With Quote
Old 07-02-2009   #2 (permalink)
Just Joined!
 
Join Date: Jul 2009
Posts: 16
OK, I am not a super-expert by any stretch(!) but since you've received no replies I'll give 'er a shot.

I would think the unix command will be similar. Perhaps something like:

ls -al > (insert your file path/name here without parens)

eg, ls -al > /media/whatever/file.txt

good luck!
komodo-dragon is offline   Reply With Quote
Old 07-02-2009   #3 (permalink)
Just Joined!
 
Join Date: Jul 2009
Posts: 16
BTW, add the "-R" switch for recursive. Enter "man ls syn" for ls switches (there are quite a few)...good luck!
komodo-dragon is offline   Reply With Quote
Old 07-02-2009   #4 (permalink)
Just Joined!
 
Join Date: Jul 2009
Posts: 2
Will I be able to read the text file created in Windows?
Shaitan00 is offline   Reply With Quote
Old 07-02-2009   #5 (permalink)
Just Joined!
 
Join Date: Jul 2009
Posts: 16
Hello again, actually give "ls -gR" a try in a terminal. I've been playing around with the dir command a little in Windows and I think the "ls -gR" might give you closer to what you're looking for.

And yes, you should have no problem reading the output file from either Windows or Linux. You might play around with it some (using a usb flash drive or something) - good luck
komodo-dragon is offline   Reply With Quote
Old 07-02-2009   #6 (permalink)
Just Joined!
 
Join Date: Jul 2009
Posts: 16
( oh yeah, and don't forget to ">" to your desired file after the "ls -gR" ) .... good luck.
komodo-dragon is offline   Reply With Quote
Old 07-03-2009   #7 (permalink)
Linux Engineer
 
D-cat's Avatar
 
Join Date: Jan 2009
Location: Dover, NH
Posts: 1,425
There is a slight difference in how Windows and *nix handles text files (CRLF vs just CR at the end of a line). Generally however, if you load a *nix txt file in Windows with Wordpad instead of Notepad, it'll automatically correct for the difference and display the file normally. Alternatively is a program called unix2dos which will also make the necessary adjustment.

and btw: ls -lR > /dir/to/file.txt is the equivilent command to DIR /S > M:\to\file.txt .
__________________
You just WON the game!
D-cat is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 03:44 AM.






© 2000 - 2009 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.0 RC2