Hi Timothy,

On Thu, 20 Apr 2006 21:31:42 -0400 Timothy Driscoll wrote:

> I need to ensure that a whole bunch of files use unix line endings and
> not Mac.  I have been doing this one file at a time in BBEdit, but I
> have a lot of files.  can anyone recommend a batch process? almost
> anything will do - script, software, Automator, ...

you can use this Applescript to batch convert line endings of all text
files within a chosen folder to Unix:

-- BEGIN SCRIPT (watch for line breaks!) --

set SourceFolderPath to choose folder with prompt "Choose a folder to convert 
line endings of all contained text files:"

tell application "Finder"
        try
                --- files ending with ".txt":
                -- set FilesList to ((every file of entire contents of folder 
SourceFolderPath whose name ends with ".txt") as alias) as list
                --- files with file type "TEXT":
                set FilesList to ((every file of entire contents of folder 
SourceFolderPath whose file type is "TEXT") as alias) as list
                -- all files:
                -- set FilesList to ((every file of entire contents of folder 
SourceFolderPath) as alias) as list
        on error number -1700 from f
                -- for >1 files trick the finder by getting an alias list of 
the files from the error message:
                set FilesList to f as list
        end try
end tell

tell application "BBEdit"
        activate
        repeat with i from 1 to count FilesList
                open (item i of FilesList)
                tell text document 1
                        set line breaks to Unix -- Mac, DOS, Unix
                        close saving yes
                end tell
        end repeat
end tell

-- END SCRIPT --

HTH, Matthias
_____________________________________
Matthias Steffens     [EMAIL PROTECTED]
       http://www.extracts.de

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to