Compress a set of log files in a folder depending on number of files

Compress a set of log files in a folder depending on number of files

Content Index :

Compress a set of log files in a folder depending on number of files
Tag : linux , By : Florian D.
Date : November 25 2020, 07:22 PM

No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Compress files in folder to zip file by using PS

Tag : powershell , By : Jack
Date : March 29 2020, 07:55 AM
Any of those help You can detect empty directories by testing against an empty return from get-childitem. For example, this will return the list of empty directories
dir | where{$_.PSIsContainer -and -not (gci $_)}
Get-ChildItem $files | where{-not ($_.PSIsContainer -and -not (gci $_))} | foreach {$zipfile.CopyHere($_.fullname)}} 

IF depending on number of files per folder --unix

Tag : file , By : ZsA
Date : March 29 2020, 07:55 AM
Any of those help To get the number of lines I would recomend piping ls -l into wc -l, this will spit out the number of lines in your directory as follows...
Atlas $ ls -l | wc -l

amount=$(ls -l | wc -l)

if [ $amount -le 5 ]; then
    echo -n "There aren't that many files, only "
    echo -n "There are a lot of files, "

echo $amount
Atlas $ ./howManyFiles.sh
    There are a lot of files, 19
Atlas $ ./howManyFiles.sh
    There aren't that many files, only 3

Powershell to move files to folder in increments and compress each folder

Tag : batch-file , By : ciops
Date : March 29 2020, 07:55 AM
will help you A big thank you to //\O// for his out-zip function! This will do what you want:
function out-zip { 

    if (-not $path.EndsWith('.zip')) {$path += '.zip'} 

    if (-not (test-path $path)) { 
      set-content $path ("PK" + [char]5 + [char]6 + ("$([char]0)" * 18)) 
    $ZipFile = (new-object -com shell.application).NameSpace($path) 
    $input | foreach {$zipfile.CopyHere($_.fullname)} 
$Path = "C:\Temp"
$FileList = gci $path
For($i=1;$i -le [Math]::Ceiling($FileList.count/$FilesPerZip);$i++){
    md "c:\$($i)"
    gci $path|random -Count $FilesPerZip|%{$_.moveto("c:\$i\$($_.name)")}
(1..[Math]::Ceiling($FileList.count/$FilesPerZip))|%{gi "c:\$_"|out-zip "C:\$_.zip"}

How to create folder, files in this folder, compress folder (in zip or rar file) and upload this to the desktop with Jav

Tag : javascript , By : cjdavis
Date : March 29 2020, 07:55 AM
Hope this helps You can use the JSZip library to do this https://stuk.github.io/jszip/
var zip = new JSZip();
zip.file("Hello.txt", "Hello World\n");
var img = zip.folder("images");
img.file("smile.gif", imgData, {base64: true});
var content = zip.generate({type:"blob"});
saveAs(content, "example.zip");

How to compress text files of N number sub folder which contains N number text files?

Tag : batch-file , By : Myatus
Date : March 29 2020, 07:55 AM
this will help I have an answer for this problem. But this solution is using a static path, and not a dynamic path. So when this batch file is executed, it produces the output exactly as wanted, but only for a specific app folder according to code below.
set loc="C:\Program Files\WinRAR"
cd /D %loc%
rar.exe a -r -agYYYY-MM-DD -df -ep %source%\app1\log_.rar %source%\app1\*.txt
set "source=C:\Program Files\WinRAR"

for /R /D %%s in (.\*) do (
    echo %%s
    for %%F in (%%s\*.txt*) do (
        "%source%\rar.exe" a -r -agYYYY-MM-DD -df -ep %%s\log_.rar %%F
Related Posts Related QUESTIONS :
  • Securing a linux webserver for public access
  • Text Editor For Linux (Besides Vi)?
  • Shell scripting input redirection oddities
  • Replace each column with different spacing using sed
  • How to fix Tcl 'Command not found' error while trying to puts error variable?
  • How to find all files on a *NIX server containing a certain string
  • How to replace the third comma in a csv file with a space in linux using bash?
  • Using sed to replace a pattern by symbol
  • Is there a way to "escape" linux commands?
  • ImageMagick V7 and Trimming Tool for Multiple Images
  • ImageMagick V7 and Cropping Tool
  • Using bash, awk or sed to templatize a CSV file into a SQL file
  • Tomcat is not loading on browser after deploying geoserver WAR - Ubuntu
  • Killing subprocess from inside a Docker container kills the entire container
  • Embedded Linux for total beginner
  • Question about Modal Dialog in Gtk application
  • Can I user kernel-level thread in Linux kernel v2.6 and is there any way to know thread-level of my thread?
  • linux kernel booting from my bootloader
  • How to create a hex dump of file containing only the hex characters without spaces in bash?
  • Extract the file name of last slash from path
  • unable to remove a file - terminal is splitting file name into two
  • listing files in UNIX owned by a particular user
  • Which docker OS base image should I use?
  • Docker on Windows 2019 cannot switch to Linux OSType
  • How do I tail all files and exclude some files by wildcard name?
  • Bash script command to wait until docker-compose process has finished before moving on
  • Date values between two times for each day of the month
  • Socket programming issue ipv6+udp
  • How to combine multiple static libraries when the library name contains a space?
  • Aliasing a command and using it in the same line of code
  • Open iTerm2 from bash script & Run commands
  • How to prevent others for read /write on the file, while it is writing
  • Crontab error: "/tmp/crontab.calJpk":5: bad day-of-month
  • Getting syntax error using awk in parallel processing
  • cURL Bash save response body to file
  • The most clear and concise way to describe SSH commands in .gitlab-ci.yml
  • Read/write a big file randomly - mmap on every read/write?
  • Error while compiling for NodeMCU on Arduino IDE on Ubuntu
  • How to save the response body from cURL in a file when executing the command in a loop in a bash script?
  • why Linux system time adds and substracts one hour every 6 months?
  • How to exclude a specific file in scp linux shell command?
  • How to wrap lines within columns in Linux
  • How to store the output of a command that has already gone throgh pipeline
  • How to remove a certain type of files and directories from git add before commit?
  • How to check last modified date of a file in AIX using bash script?
  • What does the shell "${i%,v}" mean in run-parts.sh?
  • cat displays multi-line file content in a single line
  • No module named 'tensorflow.python.platform'
  • "Hash #" symbol cause the string to be split
  • What are the possible list of Linux bash shell injection commands?
  • curl is downloading the html rather than the actual zip file from gitlab
  • shell scripting "test " command
  • Socket incoming connections can not push_back elements concurrently to a globally defined std::vector
  • escaping complicated command line arguments in bash and ssh
  • Filtering files with the given range of inputin perl
  • Save cat command output to file
  • How to find all image tags of a running Docker container?
  • A working linux kernel + gem5 config for FS boot up in x86 SMP
  • Run script skipping files
  • How to trap exit (ctrl+c) signal in Makefile?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com