Jump to content

Recommended Posts

Posted

hi, i would create rar from all .png files in a directory having size less than 1mb and these rar should contain present.jpg in it.If the file size of .png is greater than 1mb only that file alone is rar'ed (i.e. present.jpg should not be added to that rar)..

i tried to edit the by meshing code snippets which found on the web but i couldn't achieve the result as i have very limited knowledge.. :rolleyes:

can anyone help me to get this done in a proper manner

Thanks!

@echo off
set file="*.png"
set maxbytesize=1048576
FOR /F "usebackq" %%A IN ('%file%') DO set size=%%~zA
if %size% LSS %maxbytesize% (
DO (
"C:\Program Files\WinRAR\WinRAR.exe" a -ibck -m5 -df "%cd%\%%~nF.rar" "%%F"
"C:\Program Files\WinRAR\WinRAR.exe" a -ibck -m0 "%cd%\%%~nF.rar" Present.jpg
)
) ELSE (
exit
)


Posted

I would suggest that you look into using WinRAR's @listfiles. You can use standard batch commands to create a listfile for all files below your size threshold and archive and delete them using your command line. Once done you can run a command to archive the files left, those above the size threshold.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...