powershell - Zip high volume of folders & files -


I have a big problem with the backup of a stock, with a large volume (10 000 000 +) small files where Until I know that the total megabytes of those files are not so big, but the biggest problem is the number of files. First things first: - The shares are more or less "regular", therefore the root directory containing 30 directories, all those 1 level directories, have a subfolder with a date in the format: yyMMdd.

I have created some PowerShell scripts to zip those directories based on their names, so, now, I am running backup only on .zip files, but ...

I have noticed that the time of running the script is increasing daily (because this script still needs to check all the folders) and the number of folders is increasing every day

My question is : Is there anyone - let's say - marker it Number used as: - When the script to leave before storing folders in moving and add directory archival mark today Folder, "previously stored as" running the next script.

This will give me more or less scripts runtime everyday, because this "check and amp; collection" will be more or less, the only amount of directories that are not already stored.

Can someone give advice? Any remedy? I'm just following the options.

The script is not very simplified:

  $ zip = "C: \ apps \ 7-zip \ 7z.exe" $ days_behind = -1 $ folder_data = ( Received-date). Addition ($ day_church) .string ("yyMMdd") $ store = "X: \ SHARE_ARCH \ Archive_ $ folder_data.zip" $ to_zip = (gc x: \ SHARE_ROOT ($ Folder_data)}). Full name $ option = "a", "-tzip", "-y", $ archive, $ to_zip; $ Zip option $;  

I think this problem is most problematic:

$ to_zip = (GC X: \ SHARE_ROOT -Recurse | | {$ .PSIsContainer} {? <$ .name- included ($ folder_data)}). FullName

OK, if you have PSV 3 or more, then you $ _ PSIsContainer- and and instead can add -Directory to the GCI command, which can help speed it up by filtering at the provider level instead of later

< P> This will prevent it from remembering everything and just drag all the folders into the root folder, and check to see if it has a subfolder with the desired name. These things should be sharpened.

  $ zip = "C: \ apps \ 7-zip \ 7z.exe" $ days_behind = -1 $ folder_data = (received-date). Aaday ($ days_behind) .string ("yyMMdd") $ store = "X: \ SHARE_ARCH \ Archive_ $ folder_data.zip" $ to_zip = gci X: \ SHARE_ROOT | ? {$ _. PSIsContainer- and (test path "$ _ \ $ folder_data")} | Select Full Name $ option = "a", "-tzip", "-y", $ archive, $ to_zip & amp; $ Zip $ option  

I also removed the bracket and instead used a selection-expand command. I do not know that this will actually change any speed, but in general this is cleaner.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -