Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Self-extracting archive to multiple directories?  (Read 816 times)

Tobel

  • Bay Watcher
    • View Profile
    • Tobel Plays Youtube
Self-extracting archive to multiple directories?
« on: August 06, 2013, 01:48:08 pm »

I am having a hard time articulating my issue in a google search, so I was hoping someone might take the time to read this and point me in the right direction. I've tried a few of the stackexchange groups but to no avail.

If I need to update some files on computer A using files that can be accessed on computer B, what's the fastest and most efficient way to do so?

The files to be updated on computer A will be in different directories. The source files on computer B can be accessed from the same directory.

I was looking at creating self-extracting RAR archives but you'd have to create a new one for each area, unless I'm missing something. Is there a simple program where you can say, "I want these files to extract to path C:\Area" no matter what computer it is on?

Is there a simple python script I could use for this?
Logged

jaass

  • Bay Watcher
    • View Profile
Re: Self-extracting archive to multiple directories?
« Reply #1 on: August 06, 2013, 10:33:28 pm »

If you are on windows you can probably make a simple bash script to run it.
Logged

gimlet

  • Bay Watcher
    • View Profile
Re: Self-extracting archive to multiple directories?
« Reply #2 on: August 07, 2013, 05:56:38 am »

The problem with bash or unix-y tools is that if any of the filenames have spaces like Windows LOVES to do, you'll need to deal with that, either do those by hand or edit the script you create to properly escape the spaces, or whatever.

If they're in directories that Windows thinks it should be in control of you'll have to jump through more hoops.  Assuming they're not, this is the way I'd do it:

Assumptions:  There's a reasonable number of files - more than 10 or 15 (fewer than that and I'd just do it by hand) and fewer than about 100 (then creating the list below will be unbelievably tedious unless you already have the list in a file, and you'll have to get really clever with automation)

1) Create a list of the files and destination paths, one per line, and start each line with "COPY /Y".  ie "COPY /Y afile.dat C:\Games\mygame\data\afile.dat".  Name this file with all the COPY commands something like MYCOPY.BAT. 

2) Transfer the files into a temporary directory on computer A (probably making an archive on computer B and tranferring just that to computer A).   (If you're good with an editor, you can use the editor to reverse the fields in the file to make the script to copy each file from the path on computer B to a temporary directory in preparation for the transfer - I know how to do this in vi/gvim but nothing else, alas.  A careful person would also use a slight modificaiton of the script to back up the existing files on computer A, just in case). 

3) On computer A, start a command prompt, change directory to that directory you just transferred the files, run MYCOPY.BAT to copy each file from that directory to the correct path.   Pray...
Logged

Tobel

  • Bay Watcher
    • View Profile
    • Tobel Plays Youtube
Re: Self-extracting archive to multiple directories?
« Reply #3 on: August 07, 2013, 01:50:26 pm »

Thanks Gimlet. It's only about six files, so this method will do fine. I'm just trying to make something that someone else might be able use and change the path down the road or something. Each file has a different subdirectory, so that's the only reason I don't use xcopy or something. Cheers.
Logged