Results 1 to 7 of 7
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 ...
- 07-02-2009 #1Just Joined!
- Join Date
- Jul 2009
- Posts
- 2
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,
- 07-02-2009 #2Just 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!
- 07-02-2009 #3Just 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!
- 07-02-2009 #4Just Joined!
- Join Date
- Jul 2009
- Posts
- 2
Will I be able to read the text file created in Windows?
- 07-02-2009 #5Just 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
- 07-02-2009 #6Just Joined!
- Join Date
- Jul 2009
- Posts
- 16
( oh yeah, and don't forget to ">" to your desired file after the "ls -gR" ) .... good luck.
- 07-03-2009 #7Linux Guru
- Join Date
- Jan 2009
- Location
- Dover, NH
- Posts
- 1,633
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 .


Reply With Quote