inthewayboy Posted September 2, 2005 Share Posted September 2, 2005 Okay, so this is my first time posting here, and I apologize in advance. I've tried searching the forums, but all the keyword I use seem to be too generic to get a direct hit. So I'm bringing it to you all I'm building a script that will be used to compress and then upload various files to an offsite FTP. I found an FTP script on the forums that does the upload portion very well. I've got a batch file that currently calls 7zip to compress my files. I would like to combine the both into one script. That I have no problem doing. But the compressing portion is getting to me. What I would like is for the script to call 7zip and then use the current date as the filename...here is the command line I use in my batch file: 7za.exe a -t7z -mx=9 quickbooks.7z -i@files.txt I have the 7za.exe in my System32 folder, so the path won't be an issue. The files that are compressed are contained in the files.txt, but that can be taken out if it's a problem. So my questions are: 1. How would I integrate that command line into my script...is it as simple as: RunWait ( "7za.exe a -t7z -mx=9 quickbooks.7z -i@files.txt" ) I just tried it and it looks like it will work, but can anyone advise on a problem they see with that? 2. I would like to replace "quickbooks.7z" with a variable that would equal the days date like this: 09.02.2005.7z I see there are ways to define the date format and all that, but that goes a little beyond what small scripting skills I have aquired lately. I'm willing to do all the nasty trial and error, but I have no clue as to what to focus on. Thanx again! Link to comment Share on other sites More sharing options...
inthewayboy Posted September 2, 2005 Author Share Posted September 2, 2005 Oh, I forgot to ask this. How would I reference the file name in the next part of the script, as it would be changing every day. Meaning, after the file is compressed and named, how will I tell the FTP upload part of the script which file to upload. Thanx! Link to comment Share on other sites More sharing options...
Valuater Posted September 2, 2005 Share Posted September 2, 2005 RunWait ( "7za.exe a -t7z -mx=9 quickbooks.7z -i@files.txt" )I just tried it and it looks like it will work, but can anyone advise on a problem they see with that?2. I would like to replace "quickbooks.7z" with a variable that would equal the days date like this: 09.02.2005.7z<{POST_SNAPBACK}>#1I don't see a problem, as long as it works in your test, it should be ok#2Dim $variable ; place this at the top of your script$variable = @mday & "." & @mon & "." & @year & ".7z"RunWait ( "7za.exe a -t7z -mx=9 " & $variable & " -i@files.txt" )However,you may need to rename the file first ( using the variable name) before you can use runWait.??? this i don't know... not enough info here??also later in the program use $variable to recall the name of the file you wish to up-load.hope that helps8) Link to comment Share on other sites More sharing options...
AutoChris Posted September 2, 2005 Share Posted September 2, 2005 #1I don't see a problem, as long as it works in your test, it should be ok#2Dim $variable ; place this at the top of your script$variable = @mday & "." & @mon & "." & @year & ".7z"RunWait ( "7za.exe a -t7z -mx=9 " & $variable & " -i@files.txt" )However,you may need to rename the file first ( using the variable name) before you can use runWait.??? this i don't know... not enough info here??also later in the program use $variable to recall the name of the file you wish to up-load.hope that helps8)<{POST_SNAPBACK}>Slight variation... He probably wants the date in American format (month.day.year) Otherwise, Valuator has it dead on.$variable = @mon & "." & @mday & "." & @year & ".7z" Link to comment Share on other sites More sharing options...
Valuater Posted September 3, 2005 Share Posted September 3, 2005 (edited) Slight variation... He probably wants the date in American format (month.day.year) Otherwise, Valuator has it dead on.$variable = @mon & "." & @mday & "." & @year & ".7z"<{POST_SNAPBACK}>Nice catch SerialKiller.... as a note all of my files are year.month.day I learned this years ago, it helps in searching what year i am looking for or what month in that year and ...even if you do not know the day... they list very wellmine20050831200509012005090220050903others31082005010920050209200503092005imagine which is easier to sort/search/controljust a thought8) Edited September 3, 2005 by Valuater Link to comment Share on other sites More sharing options...
inthewayboy Posted September 6, 2005 Author Share Posted September 6, 2005 Hey, thanx for all the info...I agree, it is smarter to use yyyy.mm.dd so that things are easier to find. I will keep that in mind. I'll test the suggestions later on today...got a few emergencies to handle first! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now