The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

Windows file renaming help please by c51L2005-05-03 10:56:38
  I used CygWin to do something like that by Havoc 2005-05-03 12:10:33

I took a large directory of huge text files, some in sub-directories, and wrote a script to take each one, chop the whole thing up into 150k sections, then prepend an html header to each piece, append an html footer to each piece, then save each piece with an incremented filename.

Maybe you or someone else can figure out the renaming bits from cygwin.



for h in `ls -d */.`;do
cd $h
for j in *.txt; do
k=${j%.txt}
mkdir $k
split -C 150k $j $k/$k-
rm $j
cd $k
for i in * ; do
sed "s/Untitled/$i/g" /pre.htm >/pre1.htm
# sed "s/NextFile/$i/g" /post.htm >/post1.htm
cat /pre1.htm $i /post1.htm > $i.htm
rm $i
done
echo finished with $i
cd ..
done
echo done in $h
cd ..
done
[ Reply ]

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)