Reducing file size of all files in a folder to 1 byte

Page 1 of 2 12 LastLast

  1. Posts : 157
    Win10 v20H2 Build 19042.804
       #1

    Reducing file size of all files in a folder to 1 byte


    What I need is a tool which will turn all my jpg files in a download folder to 1 byte files easily. I have thousands of files. I've already copied them where they need to be. So this download folder is purely for preventing the download of the same file more than once, and to reduce the storage space to a minimum. It also coincidentally is also a quick reference to any new downloads. The one's with real file sizes. I've looked high and low to find a tool to do this. But until now. No success. Any help would be appreciated.
      My Computer


  2. Posts : 1,656
    Windows 10 Pro x64
       #2
      My Computers


  3. Posts : 2,137
    Windows 11 Pro (latest update ... forever anal)
       #3

    I think I can understand what you're trying to do, Irfanview has a conversion facility where the user can select the file (re)size by dimensions, MPs or % of original. You mightn't be able to get them down to 1 byte, but as low as possible.

    Alternatively, create a shortcut link to each of the images (usually about 2KB in size)
      My Computers


  4. Posts : 157
    Win10 v20H2 Build 19042.804
    Thread Starter
       #4

    I don't want to resize the file as a percentage of the original. I just want to resize it the the smallest possible size of 1 byte for every file in the folder. Of course that will destroy the picture itself. But I'm not worried about that, because, as I have said, I've already copied the jpgs to a safe place. And when I download that file again it will try to rename by adding a number. ie: If I have a filename, filename.jpg, and it tries to download filename.jpg, it will rename the file to filename (1).jpg (or the next available free number for that filename).

    But now I see a flaw in my plan. After the 1st rename to filename (1).jpg the next copy would be to filename (2).jpg could be the same file, or a different file altogether. For example the filenaming convention is the authorsname.jpg, so if the author has more than 1 photo (and most do), I could end up with many copies of the same file Does that mean I would need to store the original size file (and not a 1 byte file size) and compare the filename and the filesize, before downloading any picture. What I need to do is the compare the filesize of the the downloaded file to all files on my harddisk with the same profile, ie authorsname.jpg.. authorsname (21).jpg, and only download the file as authorname (22).jpg if none of the preceding 22 files have the same filesize. I suppose that cannot be programmed by a normal individual easily. And would need some specially technical software to do that. Is anything of this kind available, free or paid?
      My Computer


  5. Posts : 1,680
    X
       #5

    You said that you want to prevent files from being downloaded, right?
    What is forcing you to re-download the files?
      My Computer


  6. Posts : 2,137
    Windows 11 Pro (latest update ... forever anal)
       #6

    stub said:
    I don't want to resize the file as a percentage of the original. I just want to resize it the the smallest possible size of 1 byte for every file in the folder. Of course that will destroy the picture itself. But I'm not worried about that, because, as I have said, I've already copied the jpgs to a safe place
    You run the resize option and direct the reduced sized files result to another folder, leaving the originals intact.

    So what's to stop you from running the file resize option to, say, 1%, (and repeating on those files, again, and again, until you've got the smallest size possible) and directing/placing the reduced sized files into the download destination folder. Then when the next downloads occur, you get an error message that the file name already exists, and presumably you've got a "skip" the download option, if that's the case.

    (Whilst I understand what you're trying to do, without the how and why makes it a bit difficult)


    stub said:
    But now I see a flaw in my plan. After the 1st rename to filename (1).jpg the next copy would be to filename (2).jpg could be the same file, or a different file altogether. For example the filenaming convention is the authorsname.jpg, so if the author has more than 1 photo (and most do), I could end up with many copies of the same file Does that mean I would need to store the original size file (and not a 1 byte file size) and compare the filename and the filesize, before downloading any picture. What I need to do is the compare the filesize of the the downloaded file to all files on my harddisk with the same profile, ie authorsname.jpg.. authorsname (21).jpg, and only download the file as authorname (22).jpg if none of the preceding 22 files have the same filesize. I suppose that cannot be programmed by a normal individual easily. And would need some specially technical software to do that. Is anything of this kind available, free or paid?
    This above bit is a little confusing, but most duplicate file finder programss have options to compare groups of files based on filename and/or size and/or date, and/or some even on content, irrespective of name/size/date.
      My Computers


  7. Posts : 56,825
    Multi-boot Windows 10/11 - RTM, RP, Beta, and Insider
       #7

    Maybe a different approach....

    You can't tell what's going to be downloaded until you actually download it....... a catch-22.

    When you go to download these files from the author's site, DL them to a different empty folder. You can choose that inside your browser. Then, using Explorer, copy from the just downloaded folder back into the Downloads main folder, skipping dups and matches.
      My Computers


  8. Posts : 3,274
    Win10
       #8

    If you are happy to use a command line tool, you can do it with an old command utility called trunc.exe. You can still download it from Google code archives (run the usual antivirus scans)
    Google Code Archive - Long-term storage for Google Code Project Hosting.

    Basically, the command usage (which you can check by using trunc /? in a command box) is :
    trunc.exe filename filesize (in bytes)
    ie
    trunc.exe filename size
    eg
    trunc.exe "alp ha.JPG" 1

    this will "truncate" the file called "alp ha.JPG" to "1" byte in size (you can even change it to 0).
    I would copy the trunc.exe to the folder containing all the .JPG files and create a batch file there (say reduceJPG.bat) to truncate all .JPGs to 1 byte like so:

    contents of
    reduceJPG.bat
    Code:
    FOR %%A IN (*.JPG) DO trunc.exe "%%A" 1
    this will truncate all the files named *.jpg in that particular folder to 1 byte.

    As this tool is quite powerful , before you begin, make sure you have a proper backup plan (just in case) to try your procedure on a test folder, as the batch file will truncate all the specified files without stopping .

    So create any testfolder with

    trunc.exe
    reduceJPG.bat
    some sample .jpg files

    and run the batch file there first, to see how it works.


    PN: trunc.exe can also be used to pad files to new larger sizes as well

    Hope that helps.
    e&oe
    Last edited by das10; 15 Mar 2020 at 17:18.
      My Computers


  9. Posts : 157
    Win10 v20H2 Build 19042.804
    Thread Starter
       #9

    f14tomcat said:
    Maybe a different approach....
    You can't tell what's going to be downloaded until you actually download it....... a catch-22.
    When you go to download these files from the author's site, DL them to a different empty folder. You can choose that inside your browser. Then, using Explorer, copy from the just downloaded folder back into the Downloads main folder, skipping dups and matches.
    I'm kinda doing a version of that now. I have my master folder of filenames and my downloaded folder. I'm running Duplicate Cleaner Pro to compare both folders and deleting any duplicate pictures. This works very well at removing all duplicate pictures whatever the filename. But the bit I don't like very much is I'm spending 50-60% of the time downloading pictures I already have. Which is a tad annoying. But I cannot see and answer too.
      My Computer


  10. Posts : 56,825
    Multi-boot Windows 10/11 - RTM, RP, Beta, and Insider
       #10

    stub said:
    I'm kinda doing a version of that now. I have my master folder of filenames and my downloaded folder. I'm running Duplicate Cleaner Pro to compare both folders and deleting any duplicate pictures. This works very well at removing all duplicate pictures whatever the filename. But the bit I don't like very much is I'm spending 50-60% of the time downloading pictures I already have. Which is a tad annoying. But I cannot see and answer too.
    That's the catch-22 part. You don't know until you know.
      My Computers


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 16:25.
Find Us




Windows 10 Forums