Page 1 of 1
How to save multiple files at the same time
Posted: Mon Apr 08, 2002 6:35 am
by Kevin
Hi,
I am trying to convert about a few hundred txt files in PC format to UNIX format using Textpad (of the same filename). Is there anyway i can use the "Save As" function in Textpad to save multiple files into a different format without having to convert the files individually?? Thanks
Kevin
Re: How to save multiple files at the same time
Posted: Mon Apr 08, 2002 10:07 am
by Andreas
I'd do it without Textpad - as I only need Unix formatted files on Unix.
I'd simply set the ftp to Ascii before transmitting the files.
Re: How to save multiple files at the same time
Posted: Mon Apr 08, 2002 3:51 pm
by Rich
Just run the dos2unix tool on them.
Re: How to save multiple files at the same time
Posted: Tue Apr 09, 2002 8:06 am
by Kevin
Hi,
thanks for the suggestion but i found out that i have more than 2000 files to convert (not in any particular order) and the dos2unix tool that i downloaded also only allow me to convert 1 file at a time as it doesn't allow for wildcard entry (*.txt) for conversion. Is there any other tool that allows me to convert multiple files then? Or do i have to design a script that uses this program to convert one file at a time.
Thanks.
Re: How to save multiple files at the same time
Posted: Tue Apr 09, 2002 9:17 am
by Andreas
Create a list of all the files involved in Textpad
(e.g. open them all, then go to Edit/Copy Other/All file names)
Now paste the filenames into a new file.
Replace
^.
by
dos2html &
save the file as convert.bat
run the bat in a dos box
Re: How to save multiple files at the same time
Posted: Tue Apr 09, 2002 1:25 pm
by Kevin
Thanks. It worked.
Re: How to save multiple files at the same time
Posted: Wed Apr 17, 2002 9:30 am
by Jan Paul
The dos2unix does support wildcards (I us them all the time), so dos2unix.exe *.txt must work.
If this does not work you can use the for statement:
for %a in (*.txt) do dos2unix.exe %a
If this fails, you can also use the dir /b statement:
dir /b *.txt > file.bat
Open this file in Textpad.
Replace all file endings "\n" with "\ndos2unix "
I never figured out how to replace the first entry also and to not replace the last entry in the file, so after the replace you then must manually edit the first and last statement.
Run the batch file.
Hope this helps.
Jan Paul
Re: How to save multiple files at the same time
Posted: Wed Apr 17, 2002 9:38 am
by Jan Paul
Do you have looked at the add-on section of this site under "Convert".
These utiltites does work great and support wildcards.
Jan Paul
Re: How to save multiple files at the same time
Posted: Thu Apr 18, 2002 5:51 pm
by Rich
Older version of dos2unix didn't allow globbing (wildcards), but later version do. If you can't find a newer version, use the FOR statement.
Rich