3126
Finished Programs / Re: DONE: Sync folders by renaming files
« Last post by 4wd on June 03, 2013, 03:39 AM »there's a way to pass the extension to the batch file too, isn't there?-DyNama (June 03, 2013, 03:14 AM)
No, but who knows, there may be a way to hack it in.
then i tried RenSSv3 on a folder with 110 videos = 29.6gigs, and it's backup, of which only about a dozen files actually needed renaming. 22 .mp4s = 8gigs took about 15 minutes. 75 .wmvs = 16.8gigs took about 25minutes. does the program detect whether the file needs renaming?
It checks the size, if they are the same then it generates an MD5 checksum for each file, if they are the same it will rename one. Generating MD5 checksums take time on large files.
is there anything in the process that would balk at that?
It uses the standard DOS rename command, so if it can't handle it then it will fail. However, maybe I forgot something, I'll check.
V4 RenSSDT.cmd - matches size, date and time and asks for an extension.
Code: Text [Select]
- @if (@CodeSection == @Batch) @then
- @echo off
- setlocal EnableExtensions
- setlocal DisableDelayedExpansion
- for /F "delims=" %%S in ('CScript //nologo //E:JScript "%~F0"') do (
- if %%S=="" exit
- set srce=%%S
- )
- for /F "delims=" %%D in ('CScript //nologo //E:JScript "%~F0"') do (
- if %%D=="" exit
- set dest=%%D
- )
- echo Source folder: "%srce%"
- echo Destination folder: "%dest%"
- set /P ext=Please enter extension [eg. jpg]:
- if %ext%=="" exit
- for /r "%srce%" %%a in (*.%ext%) do (call :CheckSize "%dest%" %%~za "%%~fa")
- :End
- set srce=
- set dest=
- set ext=
- pause
- exit
- :CheckSize
- for /r %1 %%b in (*.%ext%) do (if %2 equ %%~zb call :CheckDate "%~3" "%%~b")
- goto :EOF
- :CheckDate
- if "%~t1" equ "%~t2" (
- pushd "%~dp1"
- ren "%~nx2" "%~nx1"
- )
- popd
- goto :EOF
- endlocal
- End of Batch section
- @end
- // JScript section
- // Creates a dialog box that enables the user to select a folder and display it.
- var title = "Select a folder", rootFolder = 0x11;
- var shl = new ActiveXObject("Shell.Application");
- var folder = shl.BrowseForFolder(0, title, 0, rootFolder);
- WScript.Stdout.WriteLine(folder ? folder.self.path : "");
It seems to handle files with ! in the name now, (! doesn't get passed if Delayed Expansion is enabled).
BTW, I hope you're trying these out on copies of your files before you let it run for real over your real files. As I said, it works for me with the limited testing I do but then my machine is not your machine.
EDIT:

Recent Posts






