Bigbruin.com
Home :: Reviews & Articles ::
Forum :: Info :: :: Facebook :: Youtube :: RSS Feed
Search  :: Register :: Log in
Batch copy and edit application?
Post new topic   Reply to topic    Bigbruin.com Forum Index -> Software
View previous topic :: View next topic  
Author Message
Doctor Feelgood
Arrrrghh!


Joined: 07 Apr 2003
Posts: 20349
Location: New Jersey

PostPosted: Wed, 08 Aug 2007 19:45:16    Post Subject: Batch copy and edit application? Reply with quote View Single Post

The website has old files that need to be updated and I am looking for a quick and easy way. I need to do two things.

1. There are numerous old folders that among their different contents all have the same file in them that needs to be replaced. Is there a quick way to copy one new file and have it dropped into dozens folders at once to replace what is already there?

2. There are also a variety of files in these folders that have the same name, and have the same basic content, but some variables. Is there a way to do a batch "replace all" inside these files to update select content?

Confused
Back to top
View user's profile Send private message Visit poster's website
Little Bruin
Boo Boo

Joined: 07 Apr 2003
Posts: 667
Location: Pic-A-Nic Basket
knight0334
Rated XXX


Joined: 22 Aug 2003
Posts: 2234
Location: Neither Here, Nor There

PostPosted: Thu, 09 Aug 2007 13:11:14    Post Subject: Reply with quote View Single Post

XCOPY command is your friend.

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/xcopy.mspx?mfr=true

You can do most, if not all of that with XCOPY. For each directory you would have to copy on individual command lines.


Our old cable tv database had several directories, with many files in each.. sometimes named the same, but the extention changed ( .001 or .002 or .099 etc). WinXP wouldn't recognize the RAID controller of a mobo we had for the server, so I used a batch file to XCOPY the data across (2) HDDs with (4) partitions each. One partition was the actual daily used database, one was daily backup, another was a bi-weekly, another was a monthly. It'd make it's timed backup at 3-4am, then mirror to the other drive as soon as the backup was made.
Back to top
View user's profile Send private message
BeerCheeze
*hick*


Joined: 14 Jun 2003
Posts: 9285
Location: At the Bar

PostPosted: Thu, 09 Aug 2007 14:09:58    Post Subject: Reply with quote View Single Post

I'm guessing this is Linux and not Windows. Maybe you can script something with like rsync?
Back to top
View user's profile Send private message
knight0334
Rated XXX


Joined: 22 Aug 2003
Posts: 2234
Location: Neither Here, Nor There

PostPosted: Thu, 09 Aug 2007 14:29:46    Post Subject: Reply with quote View Single Post

Hmm.. if it is Linux, nevermind my post. lol
Back to top
View user's profile Send private message
Blue|Fusion
Rated XXX


Joined: 30 May 2005
Posts: 441
Location: Cleveland, OH

PostPosted: Thu, 09 Aug 2007 14:39:56    Post Subject: Reply with quote View Single Post

1. You can make a script to use rsync on all of the directories. Something like this:

Code:

dir_list="/home/dir1
/home/dir2
/home/dir3"

for dir in $dir_list; do
   rsync -av /root/new.file $dir
done


2. sed. After you finally get a working sed command that does what you want, it might have been faster doing it all by hand depending how many files there are.

_________________
5 home-built PCs, ASUS A6Jc Laptop, and a PowerEdge 2650 - all running Gentoo. Now if only I can get a car and plane to run it. Take a look at my Gallery!
Back to top
View user's profile Send private message
Doctor Feelgood
Arrrrghh!


Joined: 07 Apr 2003
Posts: 20349
Location: New Jersey

PostPosted: Thu, 09 Aug 2007 14:41:51    Post Subject: Reply with quote View Single Post

I hope I can figure out the options presented on item 1. - thanks.

I got 2. solved with an app I already had. This HTML editing app allowed me to open all 165 files and do a find / replace all to make my updates.

Now to get the one file copied into the dozens of folders.

Oh, and it is Windows. I downloaded everything to home in order to make the changes.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Bigbruin.com Forum Index -> Software All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
Contact Us :: On Facebook :: On Youtube :: Newsletter :: RSS Feed :: FAQ :: Links :: Sponsors :: Privacy Policy
Copyright © 2000 - 2023 Bigbruin.com - All rights reserved