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

DonationCoder.com Software > Finished Programs

Coding Snack: Switch Filenames

(1/2) > >>

Coeluh:
Let's say, i've got 2 files: filea.jpg and fileb.jpg

But I want filea.jpg to be fileb.jpg and fileb.jpg to be filea.jpg. Normally the filenames I want to switch are longer, so it takes longer to switch them, because I have to copy/paste twice and stuff. I want a simple tool where I can drop 2 items and they will switch filenames.

Thanks a lot in advance! :)

NoWhereMan:
Here is a quick batch file which does what you are asking for


--- ---@echo off

if %1.==. goto USAGE
if %1.==. goto USAGE


if not exist %1 goto NOTEXISTS
if not exist %2 goto NOTEXISTS

REM move first to temp name
set tempfile=%1.%RANDOM%

move %1 %tempfile% > NUL
move %2 %1 > NUL
move %tempfile% %2 > NUL

goto EXIT

:USAGE
echo USAGE: swap file1 file2
goto EXIT

:NOTEXISTS
echo ERROR: Can't find the file(s) you specified

:EXIT
echo.


Obviously since it's a batch file it would flash in a command prompt window, but you can hide it by creating a shortcut and setting the program status to minimized. You can then drop either the shortcut or the batch file to your sendto folder, at your convenience :)

Just copy/paste the code to a text file (notepad) and save it as swap.bat or swap.cmd and you're set

bye

skwire:
Give Switcheroo a try and see if it's what you had in mind.



Download: http://skwire.dcmembers.com/apps/switcheroo/Switcheroo.zip

Coeluh:
Give Switcheroo a try and see if it's what you had in mind.
 (see attachment in previous post) (see attachment in previous post)
Download: http://skwire.dcmembers.com/apps/switcheroo/Switcheroo.zip
-skwire (June 06, 2009, 06:43 PM)
--- End quote ---
Switcheroo is cool. But: Maybe the files are not in the same folder, and not by that not selectable at the same time. One by one dropping would be cool.

It does the same job as the batch file, but the interface is nice. :)

skwire:
Maybe the files are not in the same folder, and not by that not selectable at the same time. One by one dropping would be cool.
-Coeluh (June 07, 2009, 03:27 AM)
--- End quote ---

Try build 6.  You now have two drop methods available:

* You can drag-n-drop one file on to each of the edit fields
* You can drag-n-drop two files anywhere on the form.
Download: http://skwire.dcmembers.com/apps/switcheroo/Switcheroo.zip

Navigation

[0] Message Index

[#] Next page

Go to full version