![]() |
Automatic add date and time to Archivename
Hi!
I read in this thread a question about how to add date and time to a new archives filename when using PACL. Well, PACL have support for this, with a little help of this script of course :) Here's the code for the script Code:
'***********************************************************************Parameter 1 Can be "-d", "-t" or "-dt" -d = Add current date to the ArchiveName -t = Add current time to the ArchiveName -dt = Add current date and time to the ArchiveName Parameter 2 The commands PACOMP uses. Note: The script doesn't check if the commands are valid for PACOMP, it only check that this parameter exists. Also note: If you have more than one command in this parameter {-a -p}, you have to put quotes around these {"-a -p"}, otherwise you'll get an error as the script will take each command for a separate parameter. Parameter 3 Filename of the Archive with extension Parameter 4 Files to add to the Archive Example Code:
cscript PACOMP_DT.vbs -dt -a C:\Temp\MyArchive.zip D:\*.docKind Regards Micke |
I haven't tested it personally but thanks 'Micke' for the great scripts.
|
Thanks Micke,
Seems to work fine. Is there a way to specify year/month/day for date instead of day/month/year ? |
Quote:
I need to do some more tests before I submit the updated script. Kind Regards Micke |
Yeah. I was just about to report that "test.tar.gz" doesn't work.
I guess you know why :p |
Hi!
I think it's working correctly now. I have also update the date parameter. You can now select from different date format. Here's the updated script Code:
'***********************************************************************Parameter 1 Can be "-d", "-d1", "-d2", "-d3", "-t", "-dt", "-d1t", "-d2t", "-d3t" -d = Add current date (YYYYMMDD) to the ArchiveName -d1 = Add current date (YYYYMMDD) to the ArchiveName -d2 = Add current date (DDMMYYYY) to the ArchiveName -d3 = Add current date (MMDDYYYY) to the ArchiveName -t = Add current time to the ArchiveName -dt = Add current date and time to the ArchiveName Parameter 2 The commands PACOMP uses. Note: The script doesn't check if the commands are valid for PACOMP, it only check that this parameter exists. Also note: If you have more than one command in this parameter {-a -p}, you have to put quotes around these {"-a -p"}, otherwise you'll get an error as the script will take each command for a separate parameter. Parameter 3 Filename of the Archive with extension Parameter 4 Files to add to the Archive Example Code:
cscript PACOMP_DT.vbs -dt -a C:\Temp\MyArchive.zip D:\*.docKind Regards Micke |
Sorry, still fails with name2.tar.gz or name2.tar.bz2
Could it be the "doubled extension" (two dots) causing problems with Quote:
|
Quote:
I assume you want the date and time appear before the first dot, which would be like name2_YYYYMMDD_HHMMSS.tar.gz Is that correct? Kind Regards Micke |
Quote:
Quote:
"create.this.archive.for.me.tar.gz" which works in PACL!! ) However, this is getting too complicated. I would be happy just to PREFIX the archive name with time/date to give YYYYMMDD_HHMMSS_name2.tar.gz which I guess is much simpler (and clarifies why I asked for YEAR/Month/Day format). |
Quote:
Quote:
It's much simpler to add the date and time in the beginning of the filename. The reason for adding it between the name and the extension is that it will be easier when you list the archives in explorer and they begin with their original filename and the date and time is inside it. I'll fix this by adding the date and time before the first dot in the filename instead of the last dot. Kind Regards Micke |
Hi TBGBe!
Quote:
Code:
C:\Programs\PACL>pacomp -a Test1.tar_20100407_213915.bz2 *.txtCode:
C:\Programs\PACL>paext -e -pc:\Programs\Temp Test1.tar_20100407_213915.bz2Code:
C:\Programs\PACL>pacomp -a Test2.tar_20100407_213915.gz *.txtCode:
C:\Programs\PACL>paext -e -pc:\Programs\Temp Test2.tar_20100407_213915.gzKind Regards Micke |
1 Attachment(s)
Hmm, perhaps I'm missing something then - I get this when running the script
|
Quote:
Code:
Const PACOMP = "C:\Programs\PACL\PACOMP.exe"Kind Regards Micke |
Hi!
Here's the updated script. Now the date and time always is placed before the first dot in the filename, like this. MyArchive_YYYYMMDD_HHMMSS.properties.txt.tar.bz2 I have also put a check if PACOMP.exe exists in the specified path of the constant. If not, a message will tell you about it and the script will exit. Code:
'***********************************************************************Micke |
Quote:
However, when I remembered to change it, I still have a problem opening the archive using PowerArchiver (not PACL) as it doesn't handle the tar file because of the date text. Quote:
|
Quote:
I suspect the next script will be much more complicated than this one. I haven't sorted out yet how to solve all the problems in it, but it will be a different way of using PACL to create archives. Kind Regards Micke |
Quote:
|
see http://www.autoitscript.com/autoit3/index.shtml for a simple GUI builder. it's perfect for a wrapper around a command line tool
|
I have no plans for a GUI, as PA already has a very good and powerful GUI. I also want to thank TBGBe for taking time to test the script. Without your help I wouldn't find the problem with extensions like tar.gz and tar.bz2.
I haven't written the next upcoming script yet, but I have some ideas of what it should be able to do. You will see it when it's ready for test. Kind Regards Micke |
Quote:
P.S. Welcome back Guido :cool: |
I was never gone. I was always watching you guys big brother style. I just had nothing interesting to report. :-)
|
| All times are GMT -5. The time now is 12:32 AM. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.