Link to home
Start Free TrialLog in
Avatar of marrowyung
marrowyung

asked on

7Zip command tools

Dear all,

I read this: http://www.7-zip.org/faq.html for the command mode of 7zip as we have some kind of automated zip management cycle and we prefer to zip thing automatically without human interaction.

we have 1 Windows compressed folder (A) and 1 x windows compress folder to archive (B)what is in compressed folder so that it storge what is in compressed folder to the respective "month" folder.

ok, how can I make the 7zip do the following for us automatically:
1) move whatever which is not locked/opened from A to B.
2) archive/zip the file from A to a 7zippeed file stored in B (it can be done if it is done manaually. I just need drag and drop from A to the 7zipped file from B directly)
3) delete the archieved one from A to save place.
4) empty the recycle bin once per day.

or another method do not involve human is welcome.
Avatar of marrowyung
marrowyung

ASKER

one thing forget to say is that the files in compress folder B is basd on month. for example AUGEST.zip ,then we need to check if hte time stamp of files in folder A is created in August, then the process has to COPY to folder B first and then add to the respective zip files.
Avatar of Joe Winograd
Here are the steps as I see it:

(1) Download the 7-Zip command line version from SourceForge:
http://sourceforge.net/projects/p7zip/

(2) Capture the the 7-Zip Command Line Version User's Guide here:
http://sevenzip.sourceforge.jp/chm/cmdline/

(3) Write a script in whatever scripting language you prefer to achieve your objectives, utilizing the command line version of 7-Zip for the archiving tasks and OS commands for the other tasks.

(4) Use the Task Scheduler to schedule the various tasks on whatever schedule you desire. This is in the Triggers tab of the Task Scheduler:
User generated imageFor example, schedule emptying the Recycle Bin daily; schedule the compression mentioned in your second post monthly; etc.

Regards, Joe
"(1) Download the 7-Zip command line version from SourceForge:
http://sourceforge.net/projects/p7zip/
"
this one for unix,right? I am using it for Windows platform.

"3) Write a script in whatever scripting language you prefer to achieve your objectives, utilizing the command line version of 7-Zip for the archiving tasks and OS commands for the other tasks."

what kind of script it is, that's what I am asking.
> I am using it for Windows platform.

Sorry about that. Here's the Windows download:
http://www.7-zip.org/

I have the 64-bit version of 7-Zip installed in 64-bit W7. It defaults to putting an executable called [7z.exe] in [c:\Program Files\7-Zip\]. Here's the Help output from the command line:

Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
       [<@listfiles...>]

<Commands>
  a: Add files to archive
  b: Benchmark
  d: Delete files from archive
  e: Extract files from archive (without using directory names)
  l: List contents of archive
  t: Test integrity of archive
  u: Update files to archive
  x: eXtract files with full paths
<Switches>
  -ai[r[-|0]]{@listfile|!wildcard}: Include archives
  -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives
  -bd: Disable percentage indicator
  -i[r[-|0]]{@listfile|!wildcard}: Include filenames
  -m{Parameters}: set compression Method
  -o{Directory}: set Output directory
  -p{Password}: set Password
  -r[-|0]: Recurse subdirectories
  -scs{UTF-8 | WIN | DOS}: set charset for list files
  -sfx[{name}]: Create SFX archive
  -si[{name}]: read data from stdin
  -slt: show technical information for l (List) command
  -so: write data to stdout
  -ssc[-]: set sensitive case mode
  -ssw: compress shared files
  -t{Type}: Set type of archive
  -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options
  -v{Size}[b|k|m|g]: Create volumes
  -w[{path}]: assign Work directory. Empty path means a temporary directory
  -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames
  -y: assume Yes on all queries

> what kind of script it is, that's what I am asking.

You can use any scripting language you'd like. Many folks would use VBScript on a task like this or perhaps PowerShell. I'm a big fan of AutoHotkey and that's what I would use if I were doing it.

I don't know if you're saying that you want someone to define the tools for you (which is what I'm doing) or if you're asking to have someone write the script for you. If the latter, I don't have the bandwidth right now to do it. Perhaps someone else can. Regards, Joe
I don't think any script can do this... as it has a lot of logic inside I belive, agreee ?
ASKER CERTIFIED SOLUTION
Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
"once per day - set a daily task in Task Scheduler

based on month - set a monthly task in Task Scheduler (checking date/time stamps and creating files with the month in the file name are doable...I suggest using YYYYMM in the file name rather than JULY, AUGUST, et al., but that's a minor point)"

but I can't set more logic on the task scheduler. this make the whole thing much complex.

"So, the big question is, what do you mean by "locked/opened" and how is it determined? "

this means if the applciation still writing information to that file in that folder, this mean I can't open and copy that as a result.

I try to copy log to other location, this is not appropriate.

"The issue is whether or not the required tasks can be achieved."

yes, that's the point too, what I mean is it is too complex and it can't be done by only one tools, so the tools can't archive all of them.


When all parts comes to together, this might be too complex to make it unachievable.
> but I can't set more logic on the task scheduler. this make the whole thing much complex.

I don't think it's complex. It is easy to set tasks in the Task Scheduler to run on a periodic basis (daily, weekly, monthly, whatever).

> this means if the applciation still writing information to that file in that folder, this mean I can't open and copy that as a result.

Then your script needs to make the application exit so you can access/copy the log file. This is usually not difficult to do. For example, I have a script that runs daily via the Task Scheduler to close Outlook so that the PST file may be backed up (copied).

> yes, that's the point too, what I mean is it is too complex and it can't be done by only one tools, so the tools can't archive all of them.

I may not be understanding everything, but it doesn't seem too complex to me. You're right that it can't be done by only one tool, but I believe it can be done with a combination of several tools...7-Zip, a scripting language, an empty-recycle-bin utility, copy/move/delete utilities, etc.

> When all parts comes to together, this might be too complex to make it unachievable.

I think it's achievable, but I'll say it again that I may not be understanding all of the requirements. Regards, Joe
"Then your script needs to make the application exit "

this can be one of the good point, but that application ever stop !! it keep RECORDING.
If the app never stops and it keeps recording the log file and you are unable to copy it, then that's a big problem. Thanks for closing the question and awarding points – I appreciate it. Regards, Joe
ok, we stop that feature already, basically it is a audit trial logging feature of SQL server, but it slow down everything and kill the operation, so we stop it.
Thanks for the update.