To create a .txt file listing all the files in a directory simply enter:
ls > anyfilenameyouwant.txt
I wanted to create a text file that listed all of the MP3's in my Home/Music directory. Good thing I was using Linux, because this incredibly simple task is impossible without installing software in Windows. It is really quite powerful for getting things done!
All I had to do was. Open a terminal. CD to the Music directory and enter:
ls *.mp3 > mp3list.txt
mp3list.txt is just a name I made up on the spot. The file did not yet exist, but it does now!
Another neat little trick I learned is to create an alphabetized version of a file. This should only be done with simple files like .txt or .dat. You see I had been compiling a list of songs that I wanted to add to a compilation I am going to burn for someone, and they were not in any sort of order. I wanted the list to be alphabetical for readability purposes.
cat my_mix.txt |sort -d my_mix_AZ.txt
That's it! It creates the my_mix_AZ.txt file on the fly. Just be very careful with this. If you designate the second file the same as the first it will erase everything. I found out the hard way. Luckily I had another copy laying around in my messy folders.
Now I can take the two files and diff them using Meld, or just eyeball them side by side to find differences so much easier now that I have alphabetical versions.
No comments:
Post a Comment
Let me know what you think!