[Help] Script for auto rename files to .jpg

Discussion in 'Scripting' started by antonio8909, Jul 4, 2017.

  1. antonio8909

    antonio8909 MDL Guru

    Feb 16, 2014
    2,693
    1,301
    90
    Hi,

    I saw in reddit that MEGA is going to delete the 50gb-free account in order to put another system of achievements and I'm to do a backup of all my files to Amazon Drive. I have unlimited space for photos and I now that if I compress two files and I rename it to rar and then in cmd I hide it in a jpg, Amazon detect it as a image and I can store it but I take a lot of time doing this.

    Is there any way for hide a file into a jpg file automatically?

    Thanks a lot in advance.
     
  2. s1ave77

    s1ave77 MDL Guide Dog/Dev

    Aug 15, 2012
    14,935
    19,762
    340
    What do you mean by 'hide in CMD' :g:? Is it a simple rename?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. antonio8909

    antonio8909 MDL Guru

    Feb 16, 2014
    2,693
    1,301
    90
  4. mabaega

    mabaega MDL Senior Member

    Dec 30, 2010
    269
    165
    10
    maybe something like this?
    Code:
    Set oFS  = CreateObject("Scripting.FileSystemObject")
    Set oShell = CreateObject("Wscript.Shell")
    Set objShell = CreateObject( "Shell.Application" )
    VbsDir = oFS.GetParentFolderName(WScript.ScriptFullName)
    VbsDir = Left(WScript.ScriptFullName, InStrRev(WScript.ScriptFullName, "\"))
    Dim SelectFolder, OutputFolder
    Dim Idx : Idx=0
    Set objFolder = objShell.BrowseForFolder( 0, "Select Folder", 0, "" )
    If IsObject( objfolder ) Then
     SelectFolder = objFolder.Self.Path & "\"
     OutputFolder = SelectFolder & "OutputFiles\"
     ShellCMX= "cmd.exe /K mkdir " & OutputFolder
     oShell.Exec(ShellCMX)
     
     For Each oFile In oFS.GetFolder(SelectFolder).Files
              
       if Idx = 0 then
      Name1 = oFile.Name
      idx = idx+1
       else
      Name2 = ofile.Name
      NewName = Name1 & "_" & Name2
     
      ShellCMX = "cmd.exe /K " & VbsDir & "rar.exe a -ep " & CHR(34) & OutputFolder & NewName & ".jpg" & CHR(34)  & " " &  CHR(34)  & SelectFolder & name1 & CHR(34) & " " & CHR(34) & SelectFolder  & Name2 & CHR(34)
      oShell.Exec(ShellCMX)
      idx = 0
      
       end if
        Next
    end if
    
    copy code to notepad and save as filename.vbs
    u need rar.exe file in same directory with this file script.
     
  5. antonio8909

    antonio8909 MDL Guru

    Feb 16, 2014
    2,693
    1,301
    90
    Hi @mabaega

    Can I use WinRar.exe? I tried it and it didn't create the jpg.

    Big thanks
     
  6. Tito

    Tito Super Mod / Adviser
    Staff Member

    Nov 30, 2009
    17,437
    15,195
    340
  7. antonio8909

    antonio8909 MDL Guru

    Feb 16, 2014
    2,693
    1,301
    90
  8. mabaega

    mabaega MDL Senior Member

    Dec 30, 2010
    269
    165
    10
    #8 mabaega, Jul 4, 2017
    Last edited: Jul 4, 2017
    refer to this :
    it should work (Tested)

    Code:
    Set oFS = CreateObject("Scripting.FileSystemObject")
    Set oShell = CreateObject("Wscript.Shell")
    Set objShell = CreateObject("Shell.Application")
    VbsDir = oFS.GetParentFolderName(wscript.ScriptFullName)
    VbsDir = Left(wscript.ScriptFullName, InStrRev(wscript.ScriptFullName, "\"))
    Set objFile = oFS.CreateTextFile(VbsDir & "Hide.bat", True)
    Dim SelectFolder, OutputFolder
    Dim Idx: Idx = 0
    Set objFolder = objShell.BrowseForFolder(0, "Select Folder", 0, "")
    If IsObject(objFolder) Then
        SelectFolder = objFolder.Self.Path & "\"
        OutputFolder = SelectFolder & "OutputFiles\"
      
        objFile.WriteLine "MKDIR " & OutputFolder
        For Each ofile In oFS.GetFolder(SelectFolder).Files
      
          If Idx < 1 Then
            name1 = ofile.Name
            Idx = Idx + 1
        
          Else
        
            Name2 = ofile.Name
            NewName = name1 & "_" & Name2
          
            objFile.WriteLine VbsDir & "rar.exe a -ep " & Chr(34) & OutputFolder & NewName & ".rar" & Chr(34) & " " & Chr(34) & SelectFolder & name1 & Chr(34) & " " & Chr(34) & SelectFolder & Name2 & Chr(34)
            wscript.sleep 1000
          
            objFile.WriteLine "COPY /B " & Chr(34) & VbsDir & "ppp.Jpg" & Chr(34) & " + " & Chr(34) & OutputFolder & NewName & ".rar" & Chr(34) & " " & Chr(34) & OutputFolder & NewName & ".Jpg" & Chr(34) & " /Y"
            wscript.sleep 1000
            Idx = 0
          
          End If
        Next
      
        wscript.sleep 1000
        objFile.WriteLine "DEL " & OutputFolder & "*.rar" & ">>Hide.bat"
        objFile.Close
      
        wscript.sleep 3000
        oShell.Run (VbsDir & "hide.bat")
      
    End If
    
    U will need :
    rar.exe, jpeg file (ppp.jpg) in same folder with scripts

    rar.png
     
  9. antonio8909

    antonio8909 MDL Guru

    Feb 16, 2014
    2,693
    1,301
    90
    Hi,

    I did it but 2 popups of cmd appeared and I didn't get the image. :/
     
  10. mabaega

    mabaega MDL Senior Member

    Dec 30, 2010
    269
    165
    10
    it should create a new folder (Outputfiles) in selected directory and the output file are stored there...
    I tried repeatedly and worked well.
     
  11. antonio8909

    antonio8909 MDL Guru

    Feb 16, 2014
    2,693
    1,301
    90
    @mabaega Two black windows of cmd appeared but the Outputfiles files isn't created.

    To @Tito what does the error java.lang.outofmemoryerror java heap space in OpenStego means?
     
  12. Tito

    Tito Super Mod / Adviser
    Staff Member

    Nov 30, 2009
    17,437
    15,195
    340
    @antonio8909

    Looks like the file you want to encode is beyond the scope of the program - try to contact the dev or try to use other suggested programs.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. LiteOS

    LiteOS MDL Expert

    Mar 7, 2014
    1,400
    534
    60
    ren * *?.jpg

    https://ss64.com/nt/ren.html

    can u link to mega terminate free account thx

    also
    F:\>copy *.rar *.jpg
    will make copy and change it to jpg

    or
    copy *.rar *.*.jpg
    keep the rar ext