Jump to content


  • Posts

  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country


About radix

Contact Methods

  • Website URL

Profile Information

  • OS
    Windows 8 x64

Recent Profile Visitors

3,435 profile views

radix's Achievements



  1. I use Ubuntu. But how to write the command to process all files with this base name: file.partxx.rar? I tried this: for i in "file*"; do truncate --s +1 "file*"; done which generate a file called file* with 1 byte size. With sed was easy, but it's slow. I succeeded with this: for i in file.part*.rar; do truncate -s +1 file.part*.rar; done Actually, the above command adds 5 bytes to the eof. I used a wrong wild card for this command. Thanks!
  2. Hi, I have a number of splitted rar files, eg.: file.part01.rar file.part02.rar . . . file.partxx.rar I need to add one 0 or NULL character at the end of every file. I used the next command: for i in "file*"; do sed -i '$s/$/0/' $i; donebut it's slow for large files (it read all content of files). I tried to add the character NULL on those files with dd, but it works for one file/command line and I can't find a way to use wildcard with dd: dd if=/dev/zero bs=1 count=1 >> 'file.part01.rar'dd command works instantly even for a file with 1 GB size. I need a command or a bash script that will add NULL character at the end of every file using dd command which is faster than sed. Thanks!
  3. Running @ECHO OFFSETLOCAL ENABLEEXTENSIONSSET "FS=files*.7z.*"SET "WD=D:\New folder"SET "RS=?SHA1"FOR /F "DELIMS=*" %%A IN ("%FS%") DO SET "FN=%%A">"%WD%\%FN%.sha1" TYPE NULFOR /F "TOKENS=*" %%A IN ('FSUM.EXE -SHA1 -D"%WD%" "%FS%"') DO (SET "OL=%%A" >>"%WD%\%FN%.sha1" CALL ECHO;%%OL:%RS%=%%)it will create an output like this: 6ea15a475e8ab4db5769b3e37601a368834becb1 *files.7z.00159cf9224f46d5967d76a204e0d823f2d6e5f562e *files.7z.002I've changed the output file path to folder where 7-Zip archives are located (working directory). Thanks! It's possible to write this entire batch script in a single line and to work? I tried separating lines like this: command1 & command2... and not works due to loop.
  4. Thanks for the tip! For recursive find and replace string in multiple files: SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSIONSET New_string=new stringSET Old_string=old stringFOR /F "tokens=* delims=" %%A IN ('DIR /B /S *.txt') DO echo Processing %%A...&CALL :do_replace "%%A"GOTO :EOF:do_replaceIF EXIST "%~dpnx1.new" DEL "%~dpnx1.new"SET tomod=0FOR /F "tokens=* delims=" %%B IN ('TYPE "%~dpnx1"^|FIND "%Old_string%"') DO SET tomod=1&GOTO :outofloop:outofloopIF %tomod%==0 ECHO No match...&ECHO.&GOTO :EOFFOR /F "tokens=* delims=" %%B IN ('TYPE "%~dpnx1"') DO (SET Line=%%BSET ModLine=!Line:%Old_string%=%New_string%!IF NOT "!Line!"=="!Modline!" ECHO !Line!&ECHO !Modline!&ECHO.&&SET tomod=1ECHO !Modline!>>"%~dpnx1.new")FOR /F "tokens=* delims=" %%A IN ('DIR /B /S *.new') do move /y "%%A" "%~dpnx1"GOTO :EOF
  5. Computing SHA-1 sums is a little bit paranoid. md5 is enough secure. I compute SHA-1, because my machine is loaded up to 16% during hash calculation, which is fine. The HDD is loaded at its maximum read speed during hash computing which means that if I calculate md5 sums instead of sha-1, it will require the same amount of time. In this case a faster storage is needed to finish calculation faster. Almost all hash command line utilities, except for exactfile can max out the read speed of a HDD. AutoIt _Crypt_HashFile function is on the limit, with 175 MB/s (on a RAID0 SSD array), but it's not exactly a command line tool, though it can be used like one. Can I ask jaclaz for a modified script that can replace that string recursively in subfolders? I used: FOR /F "tokens=* delims=" %%A IN ('DIR /B /S *.sha1') DO echo Processing %%A...&CALL :do_replace "%%A"but it's not enough. Also, an example from stackoverflow doesn't work with your script. setlocal EnableDelayedExpansionfor /r "D:\\New folder" %%f in (*.txt) do ( (for /f "tokens=*" %%l in (%%f) do ( set "line=%%l" echo !line: )) >"%%~ff.new" del /q "%%~ff" ren "%%~ff.new" "%%~nxf")Thanks!
  6. SHA-1 is compromised too, so we should use SHA-512, but that will require a completely new batch script.
  7. I skipped fciv. I remove only ?SHA1 to look like checksum files generated by HashCheck Shell Extension. Thanks!
  8. I want to remove the ?SHA1 string, but I thought on using a second variable leaved blank, like in an example from stackoverflow.com. The code from the top of the batch file: SET WD=D:\New folderfsum.exe -sha1 -d"%WD%" "files*.7z.*">"%WD%\files.txt" & findstr /v ";" "%WD%\files.txt">"%WD%\files.sha1" & del /f /q "%WD%\files.txt"fsum.exe -sha1 -d"%WD%" "files1234*.7z.*">"%WD%\files1234.txt" & findstr /v ";" "%WD%\files1234.txt">"%WD%\files1234.sha1" & del /f /q "%WD%\files1234.txt"calculate the sha-1 sum for the given sets of files and remove the unwanted lines from the output files, that contain the character ; So, the entire batch file looks like this: SET WD=D:\New folderfsum.exe -sha1 -d"%WD%" "files*.7z.*">"%WD%\files.txt" & findstr /v ";" "%WD%\files.txt">"%WD%\files.sha1" & del /f /q "%WD%\files.txt"fsum.exe -sha1 -d"%WD%" "files1234*.7z.*">"%WD%\files1234.txt" & findstr /v ";" "%WD%\files1234.txt">"%WD%\files1234.sha1" & del /f /q "%WD%\files1234.txt"CD /D "%WD%"SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSIONSET New_string=SET Old_string=?SHA1FOR /F "tokens=* delims=" %%A IN ('DIR /B *.sha1') DO echo Processing %%A...&CALL :do_replace "%%A"GOTO :EOF:do_replaceIF EXIST "%~nx1.new" DEL "%~nx1.new"SET tomod=0FOR /F "tokens=* delims=" %%B IN ('TYPE "%~nx1"^|FIND "%Old_string%"') DO SET tomod=1IF %tomod%==0 ECHO No match...&ECHO.&GOTO :EOFFOR /F "tokens=* delims=" %%B IN ('TYPE "%~nx1"') DO (SET Line=%%BSET ModLine=!Line:%Old_string%=%New_string%!IF NOT "!Line!"=="!Modline!" ECHO !Line!&ECHO !Modline!&ECHO.&&SET tomod=1ECHO !Modline!>>"%~nx1.new")for %%f in (*.new) do move /y "%%f" "%~nx1"GOTO :EOF
  9. I wanted to remove ?SHA1 from the output file and jaclaz script did it.
  10. Thanks jaclaz for the neat script! Thanks Yzöwl for creating the new thread! I want to replace some unwanted characters from an output file that contains hashes for a group of big files. I used fsum hash utility. Usually, the output looks like this: ; SlavaSoft Optimizing Checksum Utility - fsum 2.52.00337 <www.slavasoft.com>;; Generated on 03/29/15 at 20:45:38 ;778e7656fa79a073adbee3be578b50e8c58e7f5a ?SHA1*files.7z.001860993761f8420c84430d945b4f31379f49bc2f7 ?SHA1*files.7z.002ef996f72db0131b9983fb0f18f823a81418b34cc ?SHA1*files.7z.003so, it's need some cleaning. I used a command line like this: SET WD=D:\New folderfsum.exe -sha1 -d"%WD%" "files*.7z.*">"%WD%\files.txt" & findstr /v ";" "%WD%\files.txt">"%WD%\files.sha1" & del /f /q "%WD%\files.txt"The problem was ?SHA1 string. The fastest (in terms of reading from storage) and cleaner (regarding the output) command line hash utility is hashutils (586 MB/s read speed from a RAID0 array made by two SSDs), but it calculate only crc32, md4, md5 and sha1. I discovered hashutils after exactfile (70 MB/s read speed from RAID0 SSD array), rhash (293 MB/s read speed from RAID0 SSD array), fsum (415 MB/s read speed from RAID0 SSD array), FileVerifier++ (386 MB/s read speed from RAID0 SSD array), powershell v4 (515 MB/s read speed from RAID0 SSD array), fciv (468 MB/s read speed from RAID0 SSD array), AutoIt _Crypt_HashFile function (175 MB/s read speed from RAID0 SSD array) and checksum from corz.org (440 MB/s read speed from RAID0 SSD array, but it's not exactly a command line utility, needing some ini file stored in %AppData% and if not find it, generate unwanted pop-ups, including opening the default web browser on their website). From the above tools it's safe to ignore exactfile and checksum from corz.org. Rhash support the largest number of hashes and can output in the command prompt window the calculation progress in percents, but can't use the advantage of a RAID0 array.
  11. Hello, It's not working, runing the test in a virtual machine generate file content like this one: ALLUSERSPROFILE=C:\Documents and Settings\All UsersAPPDATA=C:\Documents and Settings\Power User\Application DataCLIENTNAME=ConsoleCommonProgramFiles=C:\Program Files\Common FilesCOMPUTERNAME=POWERUSER-PCComSpec=C:\WINDOWS\system32\cmd.exeDEVMGR_SHOW_DETAILS=DEVMGR_SHOW_NONPRESENT_DEVICES=1FP_NO_HOST_CHECK=NOHOMEDRIVE=C:HOMEPATH=\Documents and Settings\Power UserLOGONSERVER=\\POWERUSER-PCnew=news tringNUMBER_OF_PROCESSORS=1old=XX XXOS=Windows_NTPath=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\WbemPATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSHPROCESSOR_ARCHITECTURE=x86PROCESSOR_IDENTIFIER=x86 Family 6 Model 58 Stepping 9, GenuineIntelPROCESSOR_LEVEL=6PROCESSOR_REVISION=3a09ProgramFiles=C:\Program FilesPROMPT=$P$GSESSIONNAME=ConsoleSystemDrive=C:SystemRoot=C:\WINDOWSTEMP=C:\DOCUME~1\POWERU~1\LOCALS~1\TempTMP=C:\DOCUME~1\POWERU~1\LOCALS~1\TempUSERDOMAIN=POWERUSER-PCUSERNAME=Power UserUSERPROFILE=C:\Documents and Settings\Power Userwindir=C:\WINDOWSgdfgdfgdfnews tringgdfhfghfgwhere gdfgdfgdfnews tringgdfhfghfg is the file name.
  12. Hello, I got a similar problem with the next batch script, trying to replace a string with another one in multiple files: @ECHO OFFSETLOCALfor %%* in (.) do set new=%%~n*SET "new=news tring"SET "old=XX XX"for %%f in (*.txt) do ( echo Processing %%f... ( FOR /F "delims=" %%l IN (%%f) DO ( SET "line=%%l" SETLOCAL ENABLEDELAYEDEXPANSION set "x=!line:%old%=%new%!" ECHO(!x! ENDLOCAL ) )>%%~nf.new)::for %%f in (*.new) do move /y "%%f" "%%~nf.txt"GOTO :EOFFiles that contain spaces in their names will not be edited. I tried with these lines of code: FOR /F "delims=" %%l IN (%%f) DO (FOR /F "delims=" %%l IN (^"%%f^") DO (as it's explained here: http://ss64.com/nt/syntax-dequote.html but didn't work to escape ""
  13. Thanks jaclaz to point in the right direction. The working batch script: START /WAIT CMD /C "CD %~dp0Install\Piriform_CCleaner_5.1.5075_x86_^&_x64 & Piriform_CCleaner_5.1.5075_x86_^&_x64.cmd"
  • Create New...