Hi ho!
I just want to merge all my text files in the folder “the_text_files” in to one text file.
…but how?
(and…yes I have searched for it
Hi ho!
I just want to merge all my text files in the folder “the_text_files” in to one text file.
…but how?
(and…yes I have searched for it
None of these helped?
That said, you could try something like this:
choose folder with prompt "Combine all text files from this folder:"
set sourceFolder to result
choose file name with prompt "Save combined text file as:" default location result default name "untitled.txt"
set combinedFile to quoted form of POSIX path of result
try
do shell script "cd " & quoted form of POSIX path of sourceFolder & "; cat *.txt > " & combinedFile
on error errorMsg number errorNum
display dialog "Error: (" & errorNum & "):" & return & return & errorMsg buttons "Cancel" default button 1
end try
I found the “File merge” post after some searching but it didn’t worked
BUT…your script was perfect!!!
:lol:
I have just modified it like this:
WARNING!!! The move is necessary. otherwise the script will loop and the file will get huge and you have to restart your computer!!!
set sourceFolder to "Macintosh HD:Users:Abisilla:Desktop:TheTextFileFolder:"
set combinedFile to "TheCombinedFile.txt"
set the_Done_file_path to "Macintosh HD:Users:Abisilla:Desktop:TheTextFileFolder:Done"
tell application "Finder"
try
do shell script "cd " & quoted form of POSIX path of sourceFolder & "; cat *.txt > " & combinedFile
on error errorMsg number errorNum
end try
move (every file of folder sourceFolder whose name is "TheCombinedFile.txt") to the_Done_file_path with replacing
delete (every file of folder sourceFolder whose name is "TheCombinedFile.txt")
end tell
Is there a script for batch merging xls files into one xls file? I see there are scripts for merging txt and csv files, but not Excel (xls) files. Please advise.