Batch file copy and Rename

April 12, 2010 at 20:55:25
Specs: Windows XP, 4000+ / 2gb
Hi I recently set up an ftp server to publish live screen shots of my simulator, which I am using to make animated movies and need to share with other contributors, who most use LINUX so they can't help.

I do not want to share my main application directory over ftp for safety reasons. Initially I want to copy the PNG (screen-shot) files from the MAIN Application Directory F:\Program Files\FlightGear

To another directory called Movie-Models
F:\Program Files\FlightGear\FTP\Movie-Models

And do not want to over-write any existing files with the same name that it contains.

The problem is all the screen-shots are called fgfs-screen-001.png and fgfs-screen-002.png to infinity, if the files are not cleared out or moved, if so the numbering resets.

Obviously PNG's are big files and soon take up a whole lot of disk space and don't want to have too many duplicates.

I really need to have them moved, I know how to copy files from one place to another and then as a last command del *.png after the copy has been done. But not how to handle the renaming in the destination directory. The MAIN Application always starts the numbering from 001 when the directory is empty so if their are already files 001 etc in the destination folder they may be over written can you help please ?


See More: Batch file copy and Rename

Report •

April 12, 2010 at 22:48:04
suggest posting to progrmming forum - they're good with batch and other languages as well.

Report •

April 13, 2010 at 01:37:34
Hi thank so much, but after reading some of the pages I solved it :)

@echo off
if exist *.png copy fgfs-screen*.png "C:\FTP DIR PATH\*-*.%random%*.png"
if exist *.png del *.png
echo All Screen Shots have been moved - press a key to exit!

thx :)


Report •

Related Solutions

Ask Question