Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 06, 2016, 08:00:24 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: DONE: Paste Something To Bottom Of All Text Files, Recursively  (Read 2537 times)

nkormanik

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 315
    • View Profile
    • Donate to Member
DONE: Paste Something To Bottom Of All Text Files, Recursively
« on: February 15, 2013, 02:25:49 AM »
Wondering if anyone knows of a present way, or perhaps it can be made.

I have a folder of text files, each in their own subfolders, and I want to place the following at the very bottom of each of the text files:

endsas;

Not necessary, but nice to put a blank line above, separating from rest of text.

Thanks much, folks.

Nicholas Kormanik


Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 2,779
    • View Profile
    • Donate to Member
Re: DONE: Paste Something To Bottom Of All Text Files, Recursively
« Reply #1 on: February 15, 2013, 03:40:33 AM »
Most likely you can fix that using (DC-member) stahlworks Swiss File Knife

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,474
    • View Profile
    • Donate to Member
Re: DONE: Paste Something To Bottom Of All Text Files, Recursively
« Reply #2 on: February 15, 2013, 06:11:09 AM »
Put this in a DOS batch file and then at a prompt type: RecAppTxt.cmd <path>

Where <path> is the top level directory you want, eg. RecAppTxt.cmd D:\TXT_Files_Below_Here\Demo

Don't forget to put <path> in quotes if it has spaces.

Code: Text [Select]
  1. REM RecAppTxt.cmd
  2. for /r %1 %%f in (*.txt) do (echo. >>%%f && echo "endsas;" >>%%f)

Try it on a test directory first, it worked here but who knows

nkormanik

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 315
    • View Profile
    • Donate to Member
Re: DONE: Paste Something To Bottom Of All Text Files, Recursively
« Reply #3 on: February 15, 2013, 05:50:47 PM »
Thanks 4wd.  Excellent approach.

Ath, while Swiss File Knife does a lot, I don't think it can do what's being asked.  But thanks for your suggestion.


4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,474
    • View Profile
    • Donate to Member
Re: DONE: Paste Something To Bottom Of All Text Files, Recursively
« Reply #4 on: February 15, 2013, 05:59:43 PM »
You can also split it into a two line batch/command file, just in case the resultant echo command results in a really long command line, (long path/file names).

eg.

Code: Text [Select]
  1. for /r %1 %%f in (*.txt) do (echo. >>%%f)
  2. for /r %1 %%f in (*.txt) do (echo "endsas;" >>%%f)

It'll add the blank line on the first and the the "endsas;" on the second.

nkormanik

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 315
    • View Profile
    • Donate to Member
Re: DONE: Paste Something To Bottom Of All Text Files, Recursively
« Reply #5 on: February 15, 2013, 06:06:06 PM »
Terrific, 4wd.

Hope this helps others as well.

Skwire, unless someone has more to add, another DONE.