What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Possible with a batch file?

Pages: (2): « First [ 1 ] 2 » Last »
Possible with a batch file?
Author: Message:
Jimbo
Veteran Member
*****

Avatar

Posts: 1650
Reputation: 18
32 / Male / Flag
Joined: Jul 2006
O.P. Possible with a batch file?
Would this be possible to do with a batch file? or not?

What I would like to do is, say I had the folders: C:/folder1/folder2/ and inside folder 2 were many files, say "file1.ext, file2.ext2, file3.ext3" for now. Would it be possible for a batch file to list each file, and the path before it from folder2/ so the batch file would create a txt similar to:
folder2/file1.ext
folder2/file2.ext2
folder2/file3.ext3

Could then, the same batch file, or another, copy that lines from that .txt into the bottom of another .txt in another folder such as C:/stuff/list/default.lst (well, .lst, but same priniciple)

Could it then copy all those files that were listed and paste them recursively in another folder like C:/inetpub/wwwroot/folder1/folder2, but also, bzip2 those files in the inetpup folder??

Is that possible using a batch file? or not worth the effort?


07-18-2009 10:38 AM
Profile E-Mail PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: Possible with a batch file?
dir /s /b c:\inetpub


?
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
07-18-2009 12:00 PM
Profile PM Web Find Quote Report
Jimbo
Veteran Member
*****

Avatar

Posts: 1650
Reputation: 18
32 / Male / Flag
Joined: Jul 2006
O.P. RE: Possible with a batch file?
That would just list the files and store them as a list in C:/inetpub?

I would like to list the files, copy them into the bottom of another file, the copy all the files listed to inetpub/wwwroot/folder1/folder2 and bzip them.

This post was edited on 07-18-2009 at 01:08 PM by Jimbo.
07-18-2009 01:07 PM
Profile E-Mail PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: Possible with a batch file?
dir /s /b c:\inetpub >> c:\inetpub\someotherfile

then, err, get tar and bzip2 for windows...

why bzip anyway?
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
07-18-2009 01:47 PM
Profile PM Web Find Quote Report
Jimbo
Veteran Member
*****

Avatar

Posts: 1650
Reputation: 18
32 / Male / Flag
Joined: Jul 2006
O.P. RE: Possible with a batch file?
Running a few gameservers, and need an automated system to read the models and materials folders, add them to a downloadlist, bzip them, and add to a webserver running off the same box.
07-18-2009 02:22 PM
Profile E-Mail PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: Possible with a batch file?
why do you need a download list *and* an archive though? and why does it have to be bzip2 and not just zip/rar?

or is it just the file list itself that you need to bzip?
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
07-18-2009 02:27 PM
Profile PM Web Find Quote Report
Jimbo
Veteran Member
*****

Avatar

Posts: 1650
Reputation: 18
32 / Male / Flag
Joined: Jul 2006
O.P. RE: Possible with a batch file?
Well the download list is to force clients to download files, and the source engine cannot decompress any other archive than bz2, so, its best to bz2 all files, not the directory though, but each file individually. Bzip2 isnt necesarry, but speeds up download time immensly.
07-18-2009 02:56 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Possible with a batch file?
Yes, it sure is all possible (in multiple ways)...

But I realy can't understand what you realy/exactly want to do though....

You need to give proper and very clear examples of each step if you want people to be able to create a batch file.

Are there any files listed in that "other .txt" which are not in 'folder2'?
Or is that "other txt" simply a list of all the files in 'folder2'?
Are there any files in 'folder1'?
Must the files in 'folder1' also be copied to 'C:/inetpub/wwwroot/folder1'?
Are there more subfolders 'folder3', 'folder4', etc under 'folder1'?
Are there other folders like 'folder1' under the C root and must they also be copied to 'c:\inetpub\wwwroot'?
BZip each file in 'folder2' to 'C:/inetpub' or to 'C:/inetpub/wwwroot/folder1/folder2'?
Give an extensive but exact BZip command line example, including the correct parameters, subpaths, quotes, filenames, etc so I can add it properly.
etc...
etc...

I am going to assume a lot of things here:
batch code:
@ECHO OFF
:: Be carefull, since Delayed Expansion is enabled, there will be errors if files contain "!" or other special characters in their path/file name.

:::::::::::::::::::::::::::::::::::::::::::::::
SET WWWDIR=C:\INETPUB\WWWROOT
SET LISTFILE=C:\STUFF\LIST\DEFAULT.LST
SET BZIPFILE=C:\UTILS\BZIP2.EXE
:::::::::::::::::::::::::::::::::::::::::::::::

VERIFY EXTTEST 2>NUL
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
IF ERRORLEVEL 1 GOTO NOEXTENSIONS

FOR /R %%F IN (*.*) DO (
  IF NOT "%%F"=="%~0" (
    SET FILE=%%F
    ECHO Copying !FILE:%CD%\=!...
    ECHO !FILE:%CD%\=! 2>NUL 3>&2 1>>%LISTFILE%
    MD %WWWDIR%%%~pF 1>NUL 2>&1
    COPY %%F %WWWDIR%%%~pF /Y 1>NUL 2>&1
    ECHO Compressing !FILE:%CD%\=!...
    %BZIPFILE% -fzkq9 "%WWWDIR%%%~pnxF"
  )
)
ECHO.
ECHO "%LISTFILE%" updated
ECHO.
ECHO Press any key to end...
PAUSE 1>NUL
ECHO.
GOTO END

:NOEXTENSIONS
  ECHO.
  ECHO ERROR: Command extensions can not be enabled.
  ECHO        (possible cause: wrong DOS/Windows version)
GOTO END

:END
Also see attached batch file.
Edit the batch file (the three variables between the :::: lines) before using.
Put that batch file in each 'folder1' and run it from there.

It will also copy files under 'folder1', except itself.
It will bzip each file under C:/inetpub/wwwroot/folder1 without moving it to somewhere else (so you will have two versions of each file in each directory).

.zip File Attachment: SYNC.zip (672 bytes)
This file has been downloaded 127 time(s).

This post was edited on 07-20-2009 at 01:30 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
07-20-2009 12:13 AM
Profile PM Find Quote Report
Mike
Elite Member
*****

Avatar
Meet the Spam Family!

Posts: 2795
Reputation: 48
32 / Male / Flag
Joined: Mar 2003
Status: Online
RE: Possible with a batch file?
Or, you can just use SourceRSC which will do all the hard work for you (and even upload the compressed files to your server via FTP if you want) :P
YouTube closed-captions ripper (also allows you to download videos!)
07-20-2009 12:34 AM
Profile E-Mail PM Web Find Quote Report
Jimbo
Veteran Member
*****

Avatar

Posts: 1650
Reputation: 18
32 / Male / Flag
Joined: Jul 2006
O.P. RE: Possible with a batch file?
Thanks for all that work Cookie, Its really appreciated, I will remember to provide a lot more clear examples in future. However, that program Mike supplied is far easier and more user-friendly. Thanks
07-24-2009 08:07 PM
Profile E-Mail PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On