![]() |
Any way to create a file listing of a folder to txt file?
I have a few folders that I would like to print the contents of (preferably send them to a text file for editing), is there any small app that will do that?
I've discovered how to send the contents of a folder to the printer or to a PDF file, but I'd like it to be editable. (ie, just have the file names in alpha order, without having the date, file size etc. Is there any way to edit a PDF file without having to buy Adobe Acrobat? |
Quote:
But the free text editor "TextWrangler" (www.bbedit.com) has a special menu item for showing a listing of a folder's contents. |
...or you could do it the True Unix Way using Terminal:
cd /the/directory/to/list ls > filelist.txt replace /the/directory/to/list with the path to the real directory, you'll find a list of the files inside in the text file "filelist.txt" in the same directory. |
Not sure exactly when this changed in Mac OS, but when I select in Finder now and copy and attempt to paste in TextEdit, Mail, and others - the system attempts to paste the ACTUAL FILES. This is VERY ANNOYING considering for years, even pre-Mac OS X - the standard action was to copy the filenames not the actual files. The only way it actually works now - is if you make sure that the file you are pasting into is PLAIN TEXT... otherwise it will attempt to paste the actual file. And let me tell you - it will bog your machine something fierce when you try to paste 100 mp3 into a TextEdit document when what you really wanted was a text list of the mp3's.
Quote:
|
Quote:
|
Quote:
|
Quote:
Also note that the commands I suggested did never change their behaviour throughout the decades ;) . |
Just to go back a bit... if anybody does have BBEdit (this might work in TextWrangler) all you have do is drag a folder into the editable area of a document and BBEdit will create a nested list of all directories, sub-directories, and files containted therein.
And you get get around bluehz's valid point by, after copying the "files", going to the Terminal and typing `pbpaste | pbcopy`. That'll strip out the references to the files, leaving you with just a plain text list. (The command also works for converting styled text to plain text.) |
Quote:
|
Quote:
|
I actually have an Applescript that does the same thing....I got it from some site or another. I think it works faster than pulling the directory into TextWrangler...but I could be wrong...that just seemed to work slowly.
property fileName : "File List.txt" on run choose folder with prompt "Get list of files from this folder:" open {result} end run on open droppedItems set ASTID to AppleScript's text item delimiters tell application "Finder" to launch repeat with thisItem in droppedItems if (folder of (info for thisItem without size)) is true then set AppleScript's text item delimiters to (ASCII character 13) tell application "Finder" to set theList to entire contents of thisItem as text set AppleScript's text item delimiters to "" try open for access file ((thisItem as text) & fileName) with write permission set theFileRef to result write theList to theFileRef close access theFileRef on error errorMsg number errorNum try close access theFileRef end try display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "OK" default button 1 with icon caution end try end if end repeat set AppleScript's text item delimiters to ASTID return true end open |
I like the way textwrangler displays the listing of the folder contents
Here's two scripts for textwrangler, If you select your folder in finder and run the first script. It will list the contents of the folder but not sub folders. the second script will give you the full break down Code:
tell application "Finder"Code:
tell application "Finder" |
Great idea frannko - I use Quicksilver so what I did was just create a shell script:
Code:
#!/bin/shNow I can just make a selection in the Finder, invoke Quicksilver, and then "clean_clipboard" and voila. My clipboard contents are converted to plain text and ready to paste. Quote:
|
Hey guys,
Was looking for a way to do something like this and stumbled across this thread. The terminal method works fine, but I was wondering if there was any way to print sub folders and their files as well. Thanks for any input. |
Quote:
It does sub folders. **here. slight change. Code:
tell application "Finder"Code:
ls -F -R > list.txt; open list.txtCode:
ls -R > list.txt; open list.txt |
A Classic Folder File Lister
Hello ShatteredGlass,
This response is a bit late, and perhaps you have already found a viable solution to your problem via one of the previous responses, but I did want to mention that if you are using a machine that can still run in Classic mode, that is, that has Mac OS9 installed on another hard drive or partition, there is a PPC-based file lister called "Catalogger 1.0", written by John Eriksson of "SwimpSoft". I have been using this program in Classic mode for a number of years now to list the almost 36,000 files on our file server. The program is simple, but offers a few options, such as how to indent the nested files and folders, etc. However, there is one problem with this program: Being as it is an old PPC-based program, and not a true OSX-based, Cocoa program, any file names over 31 characters are truncated, and the remaining characters appear as garbage in the text file list. There is a carbonized version of the program, but it has a few GUI problems. I have written to John about this, and he informed me that he has no intentions of continuing work on Catalogger. It is for this reason that I am looking for an actual OSX-native program which will perform the same function. To date, I have not been able to find one. If you are interested in Catalogger 1.0, you can probably find it in the OS8-9 section of VersionTracker, or on some other popular Mac download site...or I'd be happy to email a copy of it to you. I don't think that the file is very large. |
Problem With Your AppleScript
Quote:
I just tried copying and pasting, and then running and/or compiling your script in the Apple Script Editor. Whenever I do so, Apple Script Editor reports an error in the following section: repeat with thisItem in droppedItems if (folder of (info for thisItem without size)) is true then set AppleScript's text item delimiters to (ASCII character 13) The word "without" is highlighted, and the error states "Syntax Error: Expected “, ” but found “without”. I am running Panther 10.3.9 on a G3 AV machine. Any ideas why I am being thrown this error? Thanks! |
Print List Without Invisible Files?
Quote:
I was wondering, however: Is there a way to tell the script to not print invisible files in the text file? I create a files list which our visitors can download from our FTP server, and they really don't need to see the invisible files that are on the server. Thanks so much in advance! |
Very Easy and Fast
I just came accross this and was not sure if you still want it.
Here is the trick with slight change. There are no apps that I know for OS X but this is faster than any app you ever think of. Open TEXTEDIT. With a new blank document press COMMAND+SHIFT+T Copy any folder contents even if it is 20GB (or 2TB). Paste it there. If you do it in a regular page it will try to paste actual docs and files, folder contents and it goes to coma. But in Plain Text it can not paste anything but pure text. I have seen a few scripts but they are crippled or slow. Forget about typing in Terminal. |
Hello Ivansahba,
Well, I just tried your idea on one particular partition. However, it did not work. While it did paste in what I had copied, it only pasted the top level folders; it didn't copy over the subfolders within those top level folders, or the files and folders contained within those subfolders. Being as it didn't do that, I can't even tell if it would indent everything properly according to level, if it did work as I had hoped. There is a program on VersionTracker, in the Tiger section I believe, which is close to doing what I want, but not quite. I can't remember the name of it at the moment, but I believe I may have written to the author, or possibly posted on his support forum, some suggestions for improving his app. Hopefully, he will consider adding the features, and we will all eventually have what we need. Considering how long OSX has been out, one would think that such a practical tool would have been written and released long ago. It leaves me a bit puzzled that it hasn't. Now, if I can just remember the name of that app. :) |
Quote:
Print Window PrintFinder |
Pardon the thread necromancy, but for the sake of anyone stumbling on this thread via Google:
Never mind all the crazy business mentioned above. Select all in Finder, then do a Paste and Match Style in TextEdit. That will paste the file names as a simple list of text. |
Won't do a hierarchical folder listing, though, only the immediate contents of the folder.
The TextWrangler/BBEdit menu item will insert a folder's contents along with not only it subfolders but their contents including their subfolders and their contents and so on. Do your whole hard disk if you want, etc etc. Be that as it may, it's great that in MacOS you can just select and do ⌘-C on files and paste in any text-savvy environment and it pastes the file names. That's not Windows-esque behavior so it's good to clue in the Windows switchers that you can do that. |
I've been trying to import the contents of a folder, and Textwrangler will give the file listings alphabetically and indent for subfolders, but I wanted to add a column that shows the dates modified for each file in the directory I import. Is there a way to do this?
|
Just select Format/Make PLain Text (Or just hit Shift+CMD+T) and then drag and drop your files into Text Edit. Simple. :)
|
I've been looking for the same sort of thing, but what's important is to get the entire path attached to the file name. For example, I don't just need index.html, which is on my desktop, but /Users/me/Desktop/index.html. Unfortunately it doesn't seem like any of the advice above does this for me.
Maybe there's a different solution though. The purpose of this is so that I can do a batch file rename using the program A Better Finder Rename 7, which requires such a tab-delimited file containing a file list with full paths and their corresponding new file names. Any advice would be greatly appreciated! I'm sure I can't be the only one with this sort of issue. :) |
@microfridge
Open a TextEdit window. Format > Make Plain Text. Drag in one or more files. If it's an entire folder, set the folder to List View, Select All, and drag files into the open TextEdit window. If there are subfolders, too, disclose them as well: Select All, Cmd-Opt-right arrow, Select All again, and drag to open TextEdit window. |
Quote:
Thanks! |
Paste folder contents
"Any way to create a file listing of a folder to txt file?"
Yes. Open folder. Select all ( Command A ) Copy ( Command C) Open Text Edit Edit > Paste and Match Style ( Shift Option Command V ) :) |
| All times are GMT -5. The time now is 02:52 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.