gocool Posted April 15, 2012 Posted April 15, 2012 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.. can anyone help me to get this done in a proper mannerThanks!@echo offset file="*.png"set maxbytesize=1048576FOR /F "usebackq" %%A IN ('%file%') DO set size=%%~zAif %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)
Yzöwl Posted April 15, 2012 Posted April 15, 2012 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now