78

My dad came with a windows laptop and asked me to convert a lot of jpg files to pdf on a usb stick (wtf?) he showed to me a tool on the laptop that convert files one by one ... and there is 58 jpg file.
Soooo I unpluged the usb key and pluged it into my linux laptop and ...

for f in *.JPG; do convert "$f" "pdf/$(basename "$f" .JPG).pdf"; done

My dad could not believe I had finished in 5 minutes

Linux Powaaaa !

Comments
  • 22
    Nice.
    If only Windows had a shell to do those basic batch jobs too, oh wait 😀
  • 2
    @nbamaral vade retro satanas windows shell (or bash4windows)
  • 2
    @DeltaEvo
    Ahahah, I meant cmd.exe. It's flawed in so many ways, but it can iterate through a list of files and do name substitution :)
  • 2
  • 5
    Didn’t know you could do that so easily. Where can I learn more about it?
  • 1
    @agentQ
    Yes, but I usually rely on just vanilla cmd, because most of the batch files are meant to run in a few hundred machines.
  • 3
    @freeme just look up bash/perl scripting I guess
  • 5
    @freeme convert come from imagemagick https://imagemagick.org/script/... it's the swiss army knife of image convertions
  • 4
    You can do it as easy in windows too. Knowledge is powaa!
  • 2
    What about the ubuntu shell on windows 10? Wouldnt that work as well?
  • 3
    @maqdude It wasn't my computer so I couldn't install it (and even if it was my computer I wouldn't install it) because linux ftw
  • 1
    @DeltaEvo i understand that, but they were mentioning cygwin and shell/powershell.. i was wondering whether or not it would be possible with ubuntu shell on windows.. I assume it will be possible.
  • 1
    @maqdude Yes I think, i only used imagemagick so .... It can be even done with windows shell
  • 5
    Did this with 700+ mp3 files! They were in webm format I thought.

    Ffmpeg in a loop and about 30 seconds later....

    Voilà!
  • 7
    Guys stop mentioning cmd that old piece of shit relic of the past. Use powershell. And it's not Linux powa, you can do it in windows too
  • 1
    You could tell to your dad something like "Do not worry dad, I am a magician, that is because I was finished in 5 minutes :D"
  • 0
    @Mayhem93
    When the last xp is replaced :(
Add Comment