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.
LVL 1
marrowyungSenior Technical architecture (Data)Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

marrowyungSenior Technical architecture (Data)Author Commented:
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.
0
Joe Winograd, Fellow&MVEDeveloperCommented:
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:
Task Scheduler TriggerFor example, schedule emptying the Recycle Bin daily; schedule the compression mentioned in your second post monthly; etc.

Regards, Joe
0
marrowyungSenior Technical architecture (Data)Author Commented:
"(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.
0
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Joe Winograd, Fellow&MVEDeveloperCommented:
> 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
0
marrowyungSenior Technical architecture (Data)Author Commented:
I don't think any script can do this... as it has a lot of logic inside I belive, agreee ?
0
Joe Winograd, Fellow&MVEDeveloperCommented:
No, I don't agree. The amount of logic isn't the issue. A script (which is a program) can have logic as complex as needed. The issue is whether or not the required tasks can be achieved. For example, you want to move files that are "not locked/opened". What exactly do you mean by "locked/opened" and is there a programmatic way to determine that? Your other requirements sound easy to achieve in a script/program:

archive - use 7-Zip command line

copy/move/delete - most scripting languages have file manipulation commands, or you can simply use built-in commands (including enhanced ones like XXCOPY, Robocopy, RichCopy, etc.)

empty recycle bin - no problem

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)

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
marrowyungSenior Technical architecture (Data)Author Commented:
"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.
0
Joe Winograd, Fellow&MVEDeveloperCommented:
> 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
0
marrowyungSenior Technical architecture (Data)Author Commented:
"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.
0
Joe Winograd, Fellow&MVEDeveloperCommented:
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
0
marrowyungSenior Technical architecture (Data)Author Commented:
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.
0
Joe Winograd, Fellow&MVEDeveloperCommented:
Thanks for the update.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Office Productivity

From novice to tech pro — start learning today.