Share this post

Link to post

Share on other sites

That should be able to be done via batch, but you might also try the free bulk rename utility - http://www.bulkrenameutility.co.uk/Main_Intro.php. One of its options is to remove a fixed number of characters from a fixed position in a file name so that fits your current situation. It also has many, many other options.

Share this post

Link to post

Share on other sites

Assuming that period at the end of that quoted sentence is not what you want ...

ren "TSP1PayStatus010512" "TSPPayStatus010512"

That batch file would need to be in the same exact folder as the file. It would be better if you mentioned the exact path to the file so it could be included in the script because then the batch file could be located anywhere.

Why don't you just select that file, Press the F2 key, and then paste this name directly on it ... TSPPayStatus010512

Share this post

Link to post

Share on other sites

Yes, I want to mass rename batch files. The batch will be scheduled to run daily. I know that the files are named TSP1PayStatusddmmyy where ddmmyy is the date. Eg. TSP1PayStatus010512.

Usually there is only 1 new file per day, sometimes 2. A software application generates the file but they then need to be renamed on a daily basis so the system can process them correctly, after which they will be automatically removed / deleted. The developers won't correct the application so I need to rename these files manually on a daily basis. It's a quick job but surely this can be automated?

I've googled and tried various scripts but none have worked so for. My batch script knowledge is very limited and the scripts I've tried so far are mostly just simple "ren" commands.

I'm really looking for a simple batch file and not a utility like "BulkRename" as still will be running on a server and server team can be a bit picky about what's allowed to run on the server.

I will give gunsmokingman's VBS script a try because it's nice and small. If not I'll give Yzöwl's batch script an attempt.

Thank you all very much for your input, folks. I will test it and allow it to run for a few days and then report back the results.

Cheers everybody. Have a good weekend in advance. :-)

'nuff

EDIT: Just noticed the VBS script looks for a filename with the specific date in it. I can't replace that date with variables / wildcard characters, can I. For now it seems the batch example provided by Yzöwl works miracles. Thanks!

Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")Dim i For Each i In Fso.GetFolder(".").Files If InStr(1,i.Name,"TSP1",1) And Left(LCase(i.Name),4)="tsp1" Then Fso.MoveFile i.Path, Replace(i.Path,Left(i.Name,4),"TSP") End If Next

Share this post

Link to post

Share on other sites

We have an FTP site where EDIs are pulled in. They then need to be renamed to get the *.EDI extension:

ren *.* *.*.edi

But amongst those files on the FTP site there are a lot of files with 0 byte size. We'd like for those NOT to be renamed. Or... another way of putting it, rename all files that are larger than 0 bytes.

It would also be okay if we move the zero byte files to another folder and then rename whichever files are left.