ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Finished Programs

DONE: Sync folders by renaming files

<< < (3/6) > >>

DyNama:
That'll do, 4wd! terrific!

i did switch %dest% and %srce% in the for loop
    for /r "%dest%" %%a in (*.%ext%) do (call :CheckSize "%srce%" %%~za "%%~fa")
cuz it is indeed backwards from v3 which i was just using 7 hours ago! no, i was in fact using the real files this time, but i was trying it on an extension that doesn't have that many renames. being backwards means it un-renamed 2 files! i retrieved their old filenames from a catalog, no problem.

i also put in prompts when choosing the folders:
    echo Choose Source Folder
so i don't lose track of what i'm doing. would it be presumptuous of me to post here the whole file of my minor changes?

the neat thing about this program is that if i choose the wrong folder or type the wrong extension, it won't find any matches so it'll do nothing. another good thing is a folder that got partially backed up to 2 different destination just renames the files that are there and doesn't copy the missing files, something every sync program wants to do. after i run the program, i use Vice Versa Free, a file comparing program, to verify it got all the files renamed.

Thanx!

mouser:
I love to see threads like this  :up:

4wd:
cuz it is indeed backwards from v3 which i was just using 7 hours ago!

i also put in prompts when choosing the folders:
    echo Choose Source Folder
so i don't lose track of what i'm doing. would it be presumptuous of me to post here the whole file of my minor changes?-DyNama (June 03, 2013, 11:10 AM)
--- End quote ---

That's fine but I may as well add them to V4 above, (later when I wake up - that's right, I'm technically supposed to be asleep - it's 0300).

Thanx!
--- End quote ---

No problem, quite a fun small script - certainly beats wracking my brain over Dll calls in AutoIt  :-\

DyNama:
just a few minor changes. i can do Echos! is there any way it can announce how many files were checksummed and how many were renamed?

yep, mouser, it's all good!


--- Code: Text [email protected] (@CodeSection == @Batch) @then     @echo off    setlocal EnableExtensions    setlocal DisableDelayedExpansion        echo Choose Source Folder    for /F "delims=" %%S in ('CScript //nologo //E:JScript "%~F0"') do (        if %%S=="" exit        set srce=%%S    )    echo _    echo Source folder: "%srce%"    echo Choose Destination Folder    for /F "delims=" %%D in ('CScript //nologo //E:JScript "%~F0"') do (        if %%D=="" exit       set dest=%%D    )    echo Destination folder: "%dest%"    set /P ext=Please enter extension [eg. jpg]:     if %ext%=="" exit        for /r "%dest%" %%a in (*.%ext%) do (call :CheckSize "%srce%" %%~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 "%~nx1" "%~nx2"    )    popd    goto :EOF        endlocal     End of Batch [email protected]  // 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 : "");

mouser:
ps. I always remind people that although certainly not required, it's always a nice gesture to donate to someone on the forum who creates something useful if you can afford it.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version