Automating a task
Automating a task
hi all,
got this archive of excels, neatly ordered. New excels come in regularly, offered in archives. I download those, unpack and then move the newly created folder with contents ('new set') to the archive ('old set'), by hand.
I would like to automate this. Thing is that the foldernames in 'new set' do not exactly match foldernames in 'old set' (say 60-80% of the foldername matches, 40-20% is different).
Any suggestions as to how (parts of) this task could be automated?
Kind regards, kazzy
got this archive of excels, neatly ordered. New excels come in regularly, offered in archives. I download those, unpack and then move the newly created folder with contents ('new set') to the archive ('old set'), by hand.
I would like to automate this. Thing is that the foldernames in 'new set' do not exactly match foldernames in 'old set' (say 60-80% of the foldername matches, 40-20% is different).
Any suggestions as to how (parts of) this task could be automated?
Kind regards, kazzy
Re: Automating a task
Not too clear on what you have, what you're getting, & what you want.
Anyhow, FASTI7.BAT:
777(.exe) is the command line version of 7-Zip (simply renamed to 777.exe - in my case).
And it basically says to take the filename(s) passed, & extract their contents into an individual (sub)directory (of the current directory) with said subdirectory named the same as the archive (or whatever the item may happen to be, so long as 7-zip can extract it).
So say you have:
C:/OUT/
And into C:/OUT/ you are getting excel*.zip files.
excel1.zip
excel2.zip
...
excel999.zip
> FASTI7.BAT excel1.zip
would extract the contents of excel1.zip into C:/OUT/excel1/
> FASTI7.BAT excel999.zip
would extract the contents of excel999.zip into C:/OUT/excel999/
> FASTI7.BAT e* (or FASTI7.BAT * if you're OK with something that broad)
would extract the contents of any file starting with E (or any file that 7-zip can unpack) into individual subdirectories in C:/OUT/, with those subdirectories named the same as the "archive" file
So with that, you have quickly & easily extracted all your files, into individual directories for each archive.
(Experiment, so you have a good feel for what is going on, because I believe, how you do things, you could run into a recursion issue, where you might unpack - everything, up to a point .)
Now that part of the directory names, & between old & new, that I'm not following at all?
Anyhow, FASTI7.BAT:
Code: Select all
777 x %* -o* %2 %3 %4
:: with %2 %3, you can do something like
:: 777 x *.zip -o* *.exe *.chm
:: which would ONLY extract .exe & .chm
:: files from the .zip, rather then (by
:: default) ALL files...
:: like for with sysinternal files, you'd
:: want the .exe & .chm, but nothing else
And it basically says to take the filename(s) passed, & extract their contents into an individual (sub)directory (of the current directory) with said subdirectory named the same as the archive (or whatever the item may happen to be, so long as 7-zip can extract it).
So say you have:
C:/OUT/
And into C:/OUT/ you are getting excel*.zip files.
excel1.zip
excel2.zip
...
excel999.zip
> FASTI7.BAT excel1.zip
would extract the contents of excel1.zip into C:/OUT/excel1/
> FASTI7.BAT excel999.zip
would extract the contents of excel999.zip into C:/OUT/excel999/
> FASTI7.BAT e* (or FASTI7.BAT * if you're OK with something that broad)
would extract the contents of any file starting with E (or any file that 7-zip can unpack) into individual subdirectories in C:/OUT/, with those subdirectories named the same as the "archive" file
So with that, you have quickly & easily extracted all your files, into individual directories for each archive.
(Experiment, so you have a good feel for what is going on, because I believe, how you do things, you could run into a recursion issue, where you might unpack - everything, up to a point .)
Now that part of the directory names, & between old & new, that I'm not following at all?
Re: Automating a task
wow, thanks man!! I will go into this coming weekend and report back Nice! regards, Kazzy
Re: Automating a task
hi therube, thanks a lot for your effort in answering my question. I am not certain whether we understand each other. Let me try to clarify my situation. Please have a look at the picture:
On the column on the left I have a few new folders with new files. The column next to that shows the existent foldertree in which those have to be merged. Third column shows what it would look like if I would do that automatically. Fourth column shows how I wished it would be (with the yellow folders being subfolders of already existing folders).
Would any such thing be possible to do automatically?
Regards, kazzy
On the column on the left I have a few new folders with new files. The column next to that shows the existent foldertree in which those have to be merged. Third column shows what it would look like if I would do that automatically. Fourth column shows how I wished it would be (with the yellow folders being subfolders of already existing folders).
Would any such thing be possible to do automatically?
Regards, kazzy
Re: Automating a task
What I proposed would give you, 'New Foldertree After Merge'.
I suppose ? something similar could be done in a loop?
Where every directory name that contains an "extension" (so, "00 Excel 03.SAR"),
you could extract it to a parent directory, named the same, sans the "extension".
So something along the lines of (& pseudo-code):
(General idea, syntax not going to be correct. You certainly would want to test... & also make sure that "00 Excel 03.SAR" is treated differently from "00 Excel 03", where with the former, you want it to go into a subdirectory, but with the latter, not.
Likewise, don't even know if -o%ni\%i is going to be valid to 7-zip?)
I suppose ? something similar could be done in a loop?
Where every directory name that contains an "extension" (so, "00 Excel 03.SAR"),
you could extract it to a parent directory, named the same, sans the "extension".
So something along the lines of (& pseudo-code):
Code: Select all
for %i in (*.*) do
777 x %i -o%ni\%i
done
Likewise, don't even know if -o%ni\%i is going to be valid to 7-zip?)
Re: Automating a task
So .. what aret hese zip-files called? (what pattern describes their names?) Are they all in the same folder? Are the "00 Excel*"foldernames in the zipfiles or based on the names of the zipfiles?
Please be as specific as possible as a wrong description leads to a wrong answer and all work has to be done multiple times.
(as the expression goes: "garbage in == garbage out")
Please be as specific as possible as a wrong description leads to a wrong answer and all work has to be done multiple times.
(as the expression goes: "garbage in == garbage out")
Re: Automating a task
hi, I tried but cannot get this to work, it clearly is beyond my capabilities . But I found a way to get closer to what I achieve by using this line of code the two of you came up with in another topic: regex:"^(.{5})" dupe:path;regmatch1 . I need to complete the task by hand, but this is already so much more in the direction that it saves me a load of work. So thanks a lot for that, it's great . kazzy
Re: Automating a task
If you answer the questions I asked, I will likely have a solution for you: a script that will extract the zipfile(s) to the right folder without further interaction.
If the information is personal or otherwise not meant for the public, you can send me a PM too.
If the information is personal or otherwise not meant for the public, you can send me a PM too.
Re: Automating a task
Not interested? Please say so (I need closure ..)
Re: Automating a task
hi NotNull, sent you a PM. Thanks for your efforts, truly appreciated. regards, kazzy